diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:14:11 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-28 15:14:11 +0100 |
commit | ce82146a6be87b239a0bde0b59fddf8865290b99 (patch) | |
tree | bdce5bc3ccd342e87b8e7416cdf2b426d3b80ecf /reportdesign | |
parent | a31991c4188e91326941fbe510ce70129d1ccde8 (diff) | |
parent | e8b97a52c96df9c8e8055407b1e40ed7cb9cfc67 (diff) |
Merge remote-tracking branch 'origin/feature/vclptrmerge2'
Diffstat (limited to 'reportdesign')
44 files changed, 810 insertions, 572 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() diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx index fba3c7abf59c..6a30ee88da2e 100644 --- a/reportdesign/source/ui/inc/AddField.hxx +++ b/reportdesign/source/ui/inc/AddField.hxx @@ -54,18 +54,18 @@ class OAddFieldWindow :public FloatingWindow ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess> m_xColumns; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > m_xRowSet; - ToolBox m_aActions; + VclPtr<ToolBox> m_aActions; - ::std::unique_ptr<OAddFieldWindowListBox> m_pListBox; - FixedLine m_aFixedLine; - FixedText m_aHelpText; + VclPtr<OAddFieldWindowListBox> m_pListBox; + VclPtr<FixedLine> m_aFixedLine; + VclPtr<FixedText> m_aHelpText; - PushButton m_aInsertButton; + VclPtr<PushButton> m_aInsertButton; Link m_aCreateLink; - OUString m_aCommandName; - OUString m_sFilter; + OUString m_aCommandName; + OUString m_sFilter; sal_Int32 m_nCommandType; - bool m_bEscapeProcessing; + bool m_bEscapeProcessing; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pChangeListener; ::rtl::Reference< comphelper::OContainerListenerAdapter> m_pContainerListener; @@ -80,6 +80,7 @@ public: , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xRowSet); virtual ~OAddFieldWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& _rNEvt ) SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/ColorChanger.hxx b/reportdesign/source/ui/inc/ColorChanger.hxx index 7a26c606e05b..247863a03211 100644 --- a/reportdesign/source/ui/inc/ColorChanger.hxx +++ b/reportdesign/source/ui/inc/ColorChanger.hxx @@ -27,7 +27,7 @@ namespace rptui class ColorChanger { protected: - OutputDevice* m_pDev; + VclPtr<OutputDevice> m_pDev; public: ColorChanger( OutputDevice* _pDev, const Color& _rNewLineColor) diff --git a/reportdesign/source/ui/inc/ColorListener.hxx b/reportdesign/source/ui/inc/ColorListener.hxx index e85da835e3df..c0ebffb83922 100644 --- a/reportdesign/source/ui/inc/ColorListener.hxx +++ b/reportdesign/source/ui/inc/ColorListener.hxx @@ -48,6 +48,7 @@ namespace rptui public: OColorListener(vcl::Window* _pParent,const OUString& _sColorEntry); virtual ~OColorListener(); + virtual void dispose() SAL_OVERRIDE; using Window::Notify; // SfxListener diff --git a/reportdesign/source/ui/inc/CondFormat.hxx b/reportdesign/source/ui/inc/CondFormat.hxx index 19c3cc24440e..e0ebc887027d 100644 --- a/reportdesign/source/ui/inc/CondFormat.hxx +++ b/reportdesign/source/ui/inc/CondFormat.hxx @@ -70,14 +70,13 @@ namespace rptui class ConditionalFormattingDialog :public ModalDialog ,public IConditionalFormatAction { - typedef ::boost::shared_ptr< Condition > ConditionPtr; - typedef ::std::vector< ConditionPtr > Conditions; + typedef ::std::vector< VclPtr<Condition> > Conditions; - OModuleClient m_aModuleClient; - vcl::Window* m_pConditionPlayground; - Conditions m_aConditions; - VclScrolledWindow* m_pScrollWindow; - ScrollBar* m_pCondScroll; + OModuleClient m_aModuleClient; + VclPtr<vcl::Window> m_pConditionPlayground; + Conditions m_aConditions; + VclPtr<VclScrolledWindow> m_pScrollWindow; + VclPtr<ScrollBar> m_pCondScroll; ::rptui::OReportController& m_rController; ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportControlModel > @@ -95,7 +94,7 @@ namespace rptui ::rptui::OReportController& _rController ); virtual ~ConditionalFormattingDialog(); - + virtual void dispose() SAL_OVERRIDE; // Dialog overridables virtual short Execute() SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/DateTime.hxx b/reportdesign/source/ui/inc/DateTime.hxx index e03f3ed2b41c..66639a9cafd8 100644 --- a/reportdesign/source/ui/inc/DateTime.hxx +++ b/reportdesign/source/ui/inc/DateTime.hxx @@ -40,13 +40,13 @@ class OReportController; \************************************************************************/ class ODateTimeDialog : public ModalDialog { - CheckBox* m_pDate; - FixedText* m_pFTDateFormat; - ListBox* m_pDateListBox; - CheckBox* m_pTime; - FixedText* m_pFTTimeFormat; - ListBox* m_pTimeListBox; - OKButton* m_pPB_OK; + VclPtr<CheckBox> m_pDate; + VclPtr<FixedText> m_pFTDateFormat; + VclPtr<ListBox> m_pDateListBox; + VclPtr<CheckBox> m_pTime; + VclPtr<FixedText> m_pFTTimeFormat; + VclPtr<ListBox> m_pTimeListBox; + VclPtr<OKButton> m_pPB_OK; svt::ControlDependencyManager m_aDateControlling; svt::ControlDependencyManager m_aTimeControlling; @@ -81,6 +81,7 @@ public: ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xHoldAlive ,::rptui::OReportController* _pController); virtual ~ODateTimeDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; }; diff --git a/reportdesign/source/ui/inc/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx index 0faeb693bd84..90faf2d78595 100644 --- a/reportdesign/source/ui/inc/DesignView.hxx +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -59,21 +59,21 @@ namespace rptui class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection { private: - SplitWindow m_aSplitWin; + VclPtr<SplitWindow> m_aSplitWin; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent; OReportController& m_rReportController; - OScrollWindowHelper m_aScrollWindow; - vcl::Window* m_pTaskPane; - PropBrw* m_pPropWin; - OAddFieldWindow* m_pAddField; + VclPtr<OScrollWindowHelper> m_aScrollWindow; + VclPtr<vcl::Window> m_pTaskPane; + VclPtr<PropBrw> m_pPropWin; + VclPtr<OAddFieldWindow> m_pAddField; OSectionView* m_pCurrentView; - ONavigator* m_pReportExplorer; + VclPtr<ONavigator> m_pReportExplorer; Idle m_aMarkIdle; Point m_aScrollOffset; DlgEdMode m_eMode; - sal_uInt16 m_nCurrentPosition; - sal_uInt16 m_eActObj; + sal_uInt16 m_nCurrentPosition; + sal_uInt16 m_eActObj; bool m_bFirstDraw; Size m_aGridSizeCoarse; Size m_aGridSizeFine; @@ -100,6 +100,7 @@ namespace rptui const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&, OReportController& _rController); virtual ~ODesignView(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -212,8 +213,8 @@ namespace rptui ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const; // IMarkedSection - ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; - ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; + OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE; /** fills the positions of all collapsed sections. diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx index f6d686747f1e..499525178a25 100644 --- a/reportdesign/source/ui/inc/Formula.hxx +++ b/reportdesign/source/ui/inc/Formula.hxx @@ -46,12 +46,12 @@ class FormulaDialog : public formula::FormulaModalDialog, public formula::IControlReferenceHandler { ::boost::shared_ptr< formula::IFunctionManager > m_aFunctionManager; - formula::FormEditData* m_pFormulaData; - OAddFieldWindow* m_pAddField; + formula::FormEditData* m_pFormulaData; + VclPtr<OAddFieldWindow> m_pAddField; ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > m_xRowSet; ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFormulaParser> m_xParser; ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> m_xOpCodeMapper; - formula::RefEdit* m_pEdit; + VclPtr<formula::RefEdit> m_pEdit; OUString m_sFormula; sal_Int32 m_nStart; sal_Int32 m_nEnd; @@ -68,6 +68,7 @@ public: , svl::SharedStringPool& rStrPool ); virtual ~FormulaDialog(); + virtual void dispose() SAL_OVERRIDE; // IFormulaEditorHelper virtual void notifyChange() SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/GroupsSorting.hxx b/reportdesign/source/ui/inc/GroupsSorting.hxx index 49b6ad0843a7..b67c1285ba98 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -60,21 +60,21 @@ class OGroupsSortingDialog : public FloatingWindow { friend class OFieldExpressionControl; - ToolBox* m_pToolBox; + VclPtr<ToolBox> m_pToolBox; sal_uInt16 m_nMoveUpId; sal_uInt16 m_nMoveDownId; sal_uInt16 m_nDeleteId; - VclContainer* m_pProperties; - ListBox* m_pOrderLst; - ListBox* m_pHeaderLst; - ListBox* m_pFooterLst; - ListBox* m_pGroupOnLst; - NumericField* m_pGroupIntervalEd; - ListBox* m_pKeepTogetherLst; - FixedText* m_pHelpWindow; + VclPtr<VclContainer> m_pProperties; + VclPtr<ListBox> m_pOrderLst; + VclPtr<ListBox> m_pHeaderLst; + VclPtr<ListBox> m_pFooterLst; + VclPtr<ListBox> m_pGroupOnLst; + VclPtr<NumericField> m_pGroupIntervalEd; + VclPtr<ListBox> m_pKeepTogetherLst; + VclPtr<FixedText> m_pHelpWindow; - OFieldExpressionControl* m_pFieldExpression; + VclPtr<OFieldExpressionControl> m_pFieldExpression; ::rptui::OReportController* m_pController; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pCurrentGroupListener; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; @@ -145,6 +145,7 @@ public: ,bool _bReadOnly ,::rptui::OReportController* _pController); virtual ~OGroupsSortingDialog(); + virtual void dispose() SAL_OVERRIDE; /** sets the newe columns at the groups dialog. @param _xColumns the new columns diff --git a/reportdesign/source/ui/inc/MarkedSection.hxx b/reportdesign/source/ui/inc/MarkedSection.hxx index 52ee1d3f62e8..84f9258809a2 100644 --- a/reportdesign/source/ui/inc/MarkedSection.hxx +++ b/reportdesign/source/ui/inc/MarkedSection.hxx @@ -38,7 +38,7 @@ namespace rptui public: /** returns the section which is currently marked. */ - virtual ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa) const =0; + virtual OSectionWindow* getMarkedSection(NearSectionAccess nsa) const =0; /** mark the section on the given position . * diff --git a/reportdesign/source/ui/inc/PageNumber.hxx b/reportdesign/source/ui/inc/PageNumber.hxx index fcf6d6b24fe0..43a1915d8e81 100644 --- a/reportdesign/source/ui/inc/PageNumber.hxx +++ b/reportdesign/source/ui/inc/PageNumber.hxx @@ -37,14 +37,14 @@ class OReportController; \************************************************************************/ class OPageNumberDialog : public ModalDialog { - RadioButton* m_pPageN; - RadioButton* m_pPageNofM; + VclPtr<RadioButton> m_pPageN; + VclPtr<RadioButton> m_pPageNofM; - RadioButton* m_pTopPage; - RadioButton* m_pBottomPage; - ListBox* m_pAlignmentLst; + VclPtr<RadioButton> m_pTopPage; + VclPtr<RadioButton> m_pBottomPage; + VclPtr<ListBox> m_pAlignmentLst; - CheckBox* m_pShowNumberOnFirstPage; + VclPtr<CheckBox> m_pShowNumberOnFirstPage; ::rptui::OReportController* m_pController; ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition> @@ -57,6 +57,7 @@ public: ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xHoldAlive ,::rptui::OReportController* _pController); virtual ~OPageNumberDialog(); + virtual void dispose() SAL_OVERRIDE; virtual short Execute() SAL_OVERRIDE; }; diff --git a/reportdesign/source/ui/inc/ReportController.hxx b/reportdesign/source/ui/inc/ReportController.hxx index aa749e833fd8..a902da39ccb2 100644 --- a/reportdesign/source/ui/inc/ReportController.hxx +++ b/reportdesign/source/ui/inc/ReportController.hxx @@ -93,7 +93,7 @@ namespace rptui TransferableDataHelper m_aSystemClipboard; // content of the clipboard TransferableClipboardListener* m_pClipbordNotifier; /// notifier for changes in the clipboard - OGroupsSortingDialog* m_pGroupsFloater; + VclPtr<OGroupsSortingDialog> m_pGroupsFloater; OXReportControllerObserver* m_pReportControllerObserver; @@ -457,7 +457,7 @@ namespace rptui // cppu::OPropertySetHelper virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() SAL_OVERRIDE; - ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getColumns() const; OUString getColumnLabel_throw(const OUString& i_sColumnName) const; diff --git a/reportdesign/source/ui/inc/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx index bef2ae1e2ea4..a34a4fc98322 100644 --- a/reportdesign/source/ui/inc/ReportSection.hxx +++ b/reportdesign/source/ui/inc/ReportSection.hxx @@ -45,7 +45,7 @@ namespace rptui { OReportPage* m_pPage; OSectionView* m_pView; - OSectionWindow* m_pParent; + VclPtr<OSectionWindow> m_pParent; ::std::unique_ptr<DlgEdFunc> m_pFunc; ::boost::shared_ptr<OReportModel> m_pModel; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pMulti; @@ -81,6 +81,7 @@ namespace rptui public: OReportSection(OSectionWindow* _pParent,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection); virtual ~OReportSection(); + virtual void dispose() SAL_OVERRIDE; // window overrides virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/ReportWindow.hxx b/reportdesign/source/ui/inc/ReportWindow.hxx index a416b74a94bd..7c974bd0ad58 100644 --- a/reportdesign/source/ui/inc/ReportWindow.hxx +++ b/reportdesign/source/ui/inc/ReportWindow.hxx @@ -45,10 +45,10 @@ namespace rptui , public ::cppu::BaseMutex , public ::comphelper::OPropertyChangeListener { - Ruler m_aHRuler; - ODesignView* m_pView; - OScrollWindowHelper* m_pParent; - OViewsWindow m_aViewsWindow; + VclPtr<Ruler> m_aHRuler; + VclPtr<ODesignView> m_pView; + VclPtr<OScrollWindowHelper> m_pParent; + VclPtr<OViewsWindow> m_aViewsWindow; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener; ::std::unique_ptr<DlgEdFactory> m_pObjFac; @@ -67,6 +67,7 @@ namespace rptui public: OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView); virtual ~OReportWindow(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void Resize() SAL_OVERRIDE; @@ -136,7 +137,7 @@ namespace rptui */ void showRuler(bool _bShow); - inline sal_Int32 getRulerHeight() const { return m_aHRuler.GetSizePixel().Height(); } + inline sal_Int32 getRulerHeight() const { return m_aHRuler->GetSizePixel().Height(); } /** returns the total width of the first section */ @@ -179,8 +180,8 @@ namespace rptui void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark); // IMarkedSection - ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; - ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; + OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx index ec5cc90d2439..e45d9daac713 100644 --- a/reportdesign/source/ui/inc/ScrollHelper.hxx +++ b/reportdesign/source/ui/inc/ScrollHelper.hxx @@ -48,14 +48,14 @@ namespace rptui , public IMarkedSection { private: - ScrollBar m_aHScroll; - ScrollBar m_aVScroll; - ScrollBarBox m_aCornerWin; // window in the bottom right corner - Size m_aTotalPixelSize; - ODesignView* m_pParent; - OReportWindow m_aReportWindow; + VclPtr<ScrollBar> m_aHScroll; + VclPtr<ScrollBar> m_aVScroll; + VclPtr<ScrollBarBox> m_aCornerWin; // window in the bottom right corner + Size m_aTotalPixelSize; + VclPtr<ODesignView> m_pParent; + VclPtr<OReportWindow> m_aReportWindow; ::rtl::Reference<comphelper::OPropertyChangeMultiplexer > - m_pReportDefintionMultiPlexer; // listener for property changes + m_pReportDefintionMultiPlexer; // listener for property changes DECL_LINK( ScrollHdl, ScrollBar*); Size ResizeScrollBars(); @@ -74,17 +74,18 @@ namespace rptui public: OScrollWindowHelper( ODesignView* _pReportDesignView); virtual ~OScrollWindowHelper(); + virtual void dispose() SAL_OVERRIDE; /** late ctor */ void initialize(); - inline Point getThumbPos() const { return Point(m_aHScroll.GetThumbPos(),m_aVScroll.GetThumbPos())/*m_aScrollOffset*/; } - inline const OReportWindow& getReportWindow() const { return m_aReportWindow; } + inline Point getThumbPos() const { return Point(m_aHScroll->GetThumbPos(),m_aVScroll->GetThumbPos())/*m_aScrollOffset*/; } + inline const OReportWindow& getReportWindow() const { return *m_aReportWindow.get(); } void setTotalSize(sal_Int32 _nWidth, sal_Int32 _nHeight); inline Size getTotalSize() const { return m_aTotalPixelSize; } - inline ScrollBar& GetHScroll() { return m_aHScroll; } - inline ScrollBar& GetVScroll() { return m_aVScroll; } + inline ScrollBar& GetHScroll() { return *m_aHScroll.get(); } + inline ScrollBar& GetVScroll() { return *m_aVScroll.get(); } // forwards void SetMode( DlgEdMode _eMode ); @@ -173,8 +174,8 @@ namespace rptui void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark); // IMarkedSection - ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; - ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; + OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/SectionView.hxx b/reportdesign/source/ui/inc/SectionView.hxx index 14de81adc63e..c8f14e26ee4b 100644 --- a/reportdesign/source/ui/inc/SectionView.hxx +++ b/reportdesign/source/ui/inc/SectionView.hxx @@ -34,8 +34,8 @@ class OReportSection; class OSectionView : public SdrView { private: - OReportWindow* m_pReportWindow; - OReportSection* m_pSectionWindow; + VclPtr<OReportWindow> m_pReportWindow; + VclPtr<OReportSection> m_pSectionWindow; void ObjectRemovedInAliveMode( const SdrObject* pObject ); OSectionView(const OSectionView&) SAL_DELETED_FUNCTION; diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx index 79e184cb9d0b..166c25cd6a48 100644 --- a/reportdesign/source/ui/inc/SectionWindow.hxx +++ b/reportdesign/source/ui/inc/SectionWindow.hxx @@ -47,11 +47,11 @@ namespace rptui , public ::cppu::BaseMutex , public ::comphelper::OPropertyChangeListener { - OViewsWindow* m_pParent; - OStartMarker m_aStartMarker; - OReportSection m_aReportSection; - Splitter m_aSplitter; - OEndMarker m_aEndMarker; + VclPtr<OViewsWindow> m_pParent; + VclPtr<OStartMarker> m_aStartMarker; + VclPtr<OReportSection> m_aReportSection; + VclPtr<Splitter> m_aSplitter; + VclPtr<OEndMarker> m_aEndMarker; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pSectionMulti; ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pGroupMulti; @@ -98,10 +98,11 @@ namespace rptui ,const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection ,const OUString& _sColorEntry); virtual ~OSectionWindow(); + virtual void dispose() SAL_OVERRIDE; - inline OStartMarker& getStartMarker() { return m_aStartMarker; } - inline OReportSection& getReportSection() { return m_aReportSection; } - inline OEndMarker& getEndMarker() { return m_aEndMarker; } + inline OStartMarker& getStartMarker() { return *m_aStartMarker.get(); } + inline OReportSection& getReportSection() { return *m_aReportSection.get(); } + inline OEndMarker& getEndMarker() { return *m_aEndMarker.get(); } inline OViewsWindow* getViewsWindow() { return m_pParent; } void setCollapsed(bool _bCollapsed); diff --git a/reportdesign/source/ui/inc/StartMarker.hxx b/reportdesign/source/ui/inc/StartMarker.hxx index e390024f51a9..270939c266d0 100644 --- a/reportdesign/source/ui/inc/StartMarker.hxx +++ b/reportdesign/source/ui/inc/StartMarker.hxx @@ -31,10 +31,10 @@ namespace rptui class OStartMarker : public OColorListener { - Ruler m_aVRuler; - FixedText m_aText; - FixedImage m_aImage; - OSectionWindow* m_pParent; + VclPtr<Ruler> m_aVRuler; + VclPtr<FixedText> m_aText; + VclPtr<FixedImage> m_aImage; + VclPtr<OSectionWindow> m_pParent; static Image* s_pDefCollapsed; static Image* s_pDefExpanded; static oslInterlockedCount s_nImageRefCount; /// When 0 all static images will be destroyed @@ -50,6 +50,7 @@ namespace rptui public: OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry); virtual ~OStartMarker(); + virtual void dispose() SAL_OVERRIDE; // SfxListener virtual void Notify(SfxBroadcaster & rBc, SfxHint const & rHint) SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/ViewsWindow.hxx b/reportdesign/source/ui/inc/ViewsWindow.hxx index 8acd960804d1..f16fd59f2f77 100644 --- a/reportdesign/source/ui/inc/ViewsWindow.hxx +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -32,7 +32,6 @@ #include <unotools/options.hxx> #include <list> #include <vector> -#include <boost/shared_ptr.hpp> #include "MarkedSection.hxx" #include "SectionWindow.hxx" @@ -75,7 +74,7 @@ namespace rptui class OWindowPositionCorrector { - ::std::vector< ::std::pair<vcl::Window*,Point> > m_aChildren; + ::std::vector< ::std::pair<VclPtr<vcl::Window>,Point> > m_aChildren; long m_nDeltaX; long m_nDeltaY; public: @@ -91,8 +90,8 @@ namespace rptui } ~OWindowPositionCorrector() { - ::std::vector< ::std::pair<vcl::Window*,Point> >::iterator aIter = m_aChildren.begin(); - ::std::vector< ::std::pair<vcl::Window*,Point> >::iterator aEnd = m_aChildren.end(); + auto aIter = m_aChildren.begin(); + auto aEnd = m_aChildren.end(); for (; aIter != aEnd; ++aIter) { const Point aPos = aIter->first->GetPosPixel(); @@ -108,7 +107,7 @@ namespace rptui { typedef ::std::multimap<Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess> TRectangleMap; public: - typedef ::std::vector< ::boost::shared_ptr<OSectionWindow> > TSectionsMap; + typedef ::std::vector< VclPtr<OSectionWindow> > TSectionsMap; struct TReportPairHelper : public ::std::unary_function< TSectionsMap::value_type, OReportSection > { @@ -127,9 +126,9 @@ namespace rptui private: TSectionsMap m_aSections; svtools::ColorConfig m_aColorConfig; - OReportWindow* m_pParent; - OUString m_sShapeType; - bool m_bInUnmark; + VclPtr<OReportWindow> m_pParent; + OUString m_sShapeType; + bool m_bInUnmark; void ImplInitSettings(); /** returns the iterator at pos _nPos or the end() @@ -153,6 +152,7 @@ namespace rptui OViewsWindow( OReportWindow* _pReportWindow); virtual ~OViewsWindow(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void Resize() SAL_OVERRIDE; @@ -181,7 +181,7 @@ namespace rptui * \param _nPos * \return the section at this pos or an empty section */ - ::boost::shared_ptr<OSectionWindow> getSectionWindow(const sal_uInt16 _nPos) const; + OSectionWindow* getSectionWindow(const sal_uInt16 _nPos) const; /** turns the grid on or off * @@ -235,7 +235,7 @@ namespace rptui /** returns the report section window for the given xsection @param _xSection the section */ - ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; + OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const; /** checks if the keycode is known by the child windows @param _rCode the keycode @@ -252,7 +252,7 @@ namespace rptui void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark); // IMarkedSection - ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; + OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE; virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE; /** align all marked objects in all sections diff --git a/reportdesign/source/ui/inc/dlgedfunc.hxx b/reportdesign/source/ui/inc/dlgedfunc.hxx index b9d0275ce673..8f8938b6f545 100644 --- a/reportdesign/source/ui/inc/dlgedfunc.hxx +++ b/reportdesign/source/ui/inc/dlgedfunc.hxx @@ -41,7 +41,7 @@ class DlgEdFunc /* : public LinkHdl */ DlgEdFunc(const DlgEdFunc&) SAL_DELETED_FUNCTION; void operator =(const DlgEdFunc&) SAL_DELETED_FUNCTION; protected: - OReportSection* m_pParent; + VclPtr<OReportSection> m_pParent; OSectionView& m_rView; Timer aScrollTimer; Point m_aMDPos; diff --git a/reportdesign/source/ui/inc/propbrw.hxx b/reportdesign/source/ui/inc/propbrw.hxx index 43ec71c790b2..67a48b248691 100644 --- a/reportdesign/source/ui/inc/propbrw.hxx +++ b/reportdesign/source/ui/inc/propbrw.hxx @@ -58,7 +58,7 @@ private: ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xLastSection; /// is the previously displayed section OUString m_sLastActivePage; - ODesignView* m_pDesignView; + VclPtr<ODesignView> m_pDesignView; OSectionView* m_pView; bool m_bInitialStateChange; @@ -90,6 +90,7 @@ public: ,Window* pParent ,ODesignView* _pDesignView); virtual ~PropBrw(); + virtual void dispose() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE; diff --git a/reportdesign/source/ui/misc/ColorListener.cxx b/reportdesign/source/ui/misc/ColorListener.cxx index 8bbd52dd88ad..abe070802e9b 100644 --- a/reportdesign/source/ui/misc/ColorListener.cxx +++ b/reportdesign/source/ui/misc/ColorListener.cxx @@ -40,7 +40,13 @@ OColorListener::OColorListener(vcl::Window* _pParent ,const OUString& _sColorEnt OColorListener::~OColorListener() { + disposeOnce(); +} + +void OColorListener::dispose() +{ EndListening(m_aExtendedColorConfig); + vcl::Window::dispose(); } void OColorListener::Notify(SfxBroadcaster & /*rBc*/, SfxHint const & rHint) diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index 01533c7520ee..b5da44b8e31e 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -712,16 +712,16 @@ bool openCharDialog( const uno::Reference<report::XReportControlFormat >& _rxRep lcl_CharPropertiesToItems( _rxReportControlFormat, *pDescriptor ); { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(pParent, pDescriptor.get(), "CharDialog"); + ScopedVclPtrInstance< ORptPageDialog > aDlg(pParent, pDescriptor.get(), "CharDialog"); uno::Reference< report::XShape > xShape( _rxReportControlFormat, uno::UNO_QUERY ); if ( xShape.is() ) - aDlg.RemoveTabPage("background"); - bSuccess = ( RET_OK == aDlg.Execute() ); + aDlg->RemoveTabPage("background"); + bSuccess = ( RET_OK == aDlg->Execute() ); if ( bSuccess ) { lcl_itemsToCharProperties( lcl_getReportControlFont( _rxReportControlFormat,WESTERN ), lcl_getReportControlFont( _rxReportControlFormat,ASIAN ), - lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg.GetOutputItemSet(), _out_rNewValues ); + lcl_getReportControlFont( _rxReportControlFormat,COMPLEX ), *aDlg->GetOutputItemSet(), _out_rNewValues ); } } } @@ -1027,13 +1027,14 @@ bool openDialogFormula_nothrow( OUString& _in_out_rFormula CharClass aCC(_xContext, aLangTag); svl::SharedStringPool aStringPool(&aCC); - FormulaDialog aDlg( - pParent, xServiceFactory, pFormulaManager, aFormula.getUndecoratedContent(), _xRowSet, aStringPool); + ScopedVclPtrInstance<FormulaDialog> aDlg( + pParent, xServiceFactory, pFormulaManager, + aFormula.getUndecoratedContent(), _xRowSet, aStringPool); - bSuccess = aDlg.Execute() == RET_OK; + bSuccess = aDlg->Execute() == RET_OK; if ( bSuccess ) { - OUString sFormula = aDlg.getCurrentFormula(); + OUString sFormula = aDlg->getCurrentFormula(); if ( sFormula[0] == '=' ) _in_out_rFormula = "rpt:" + sFormula.copy(1); else diff --git a/reportdesign/source/ui/misc/statusbarcontroller.cxx b/reportdesign/source/ui/misc/statusbarcontroller.cxx index c59c587f0211..420f83f4b84b 100644 --- a/reportdesign/source/ui/misc/statusbarcontroller.cxx +++ b/reportdesign/source/ui/misc/statusbarcontroller.cxx @@ -86,7 +86,7 @@ void SAL_CALL OStatusbarController::initialize( const Sequence< Any >& _rArgumen SolarMutexGuard aSolarMutexGuard; ::osl::MutexGuard aGuard(m_aMutex); - StatusBar* pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow)); + VclPtr< StatusBar > pStatusBar = static_cast<StatusBar*>(VCLUnoHelper::GetWindow(m_xParentWindow).get()); if ( pStatusBar ) { const sal_uInt16 nCount = pStatusBar->GetItemCount(); diff --git a/reportdesign/source/ui/misc/toolboxcontroller.cxx b/reportdesign/source/ui/misc/toolboxcontroller.cxx index 788cc1fddfc6..aa9eb3f27672 100644 --- a/reportdesign/source/ui/misc/toolboxcontroller.cxx +++ b/reportdesign/source/ui/misc/toolboxcontroller.cxx @@ -127,7 +127,7 @@ void SAL_CALL OToolboxController::initialize( const Sequence< Any >& _rArguments SolarMutexGuard aSolarMutexGuard; ::osl::MutexGuard aGuard(m_aMutex); - ToolBox* pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent())); + VclPtr< ToolBox > pToolBox = static_cast<ToolBox*>(VCLUnoHelper::GetWindow(getParent()).get()); if ( pToolBox ) { const sal_uInt16 nCount = pToolBox->GetItemCount(); diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 96953d86019a..698b065796f6 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -59,9 +59,11 @@ using namespace container; class OTaskWindow : public vcl::Window { - PropBrw* m_pPropWin; + VclPtr<PropBrw> m_pPropWin; public: OTaskWindow(vcl::Window* _pParent) : Window(_pParent),m_pPropWin(NULL){} + virtual ~OTaskWindow() { disposeOnce(); } + virtual void dispose() SAL_OVERRIDE { m_pPropWin.clear(); vcl::Window::dispose(); } inline void setPropertyBrowser(PropBrw* _pPropWin) { @@ -84,9 +86,9 @@ ODesignView::ODesignView( vcl::Window* pParent, const Reference< XComponentContext >& _rxOrb, OReportController& _rController) : ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL ) - ,m_aSplitWin(this) + ,m_aSplitWin(VclPtr<SplitWindow>::Create(this)) ,m_rReportController( _rController ) - ,m_aScrollWindow(this) + ,m_aScrollWindow(VclPtr<rptui::OScrollWindowHelper>::Create(this)) ,m_pPropWin(NULL) ,m_pAddField(NULL) ,m_pCurrentView(NULL) @@ -107,16 +109,16 @@ ODesignView::ODesignView( vcl::Window* pParent, SetMapMode( MapMode( MAP_100TH_MM ) ); // now create the task pane on the right side :-) - m_pTaskPane = new OTaskWindow(this); + m_pTaskPane = VclPtr<OTaskWindow>::Create(this); - m_aSplitWin.InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET ); - m_aSplitWin.InsertItem( REPORT_ID, &m_aScrollWindow, 100, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); + m_aSplitWin->InsertItem( COLSET_ID,100,SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE | SWIB_COLSET ); + m_aSplitWin->InsertItem( REPORT_ID, m_aScrollWindow.get(), 100, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); // Splitter einrichten - m_aSplitWin.SetSplitHdl(LINK(this, ODesignView,SplitHdl)); - m_aSplitWin.ShowAutoHideButton(); - m_aSplitWin.SetAlign(WINDOWALIGN_LEFT); - m_aSplitWin.Show(); + m_aSplitWin->SetSplitHdl(LINK(this, ODesignView,SplitHdl)); + m_aSplitWin->ShowAutoHideButton(); + m_aSplitWin->SetAlign(WINDOWALIGN_LEFT); + m_aSplitWin->Show(); m_aMarkIdle.SetPriority( SchedulerPriority::LOW ); m_aMarkIdle.SetIdleHdl( LINK( this, ODesignView, MarkTimeout ) ); @@ -125,43 +127,46 @@ ODesignView::ODesignView( vcl::Window* pParent, ODesignView::~ODesignView() { + disposeOnce(); +} + +void ODesignView::dispose() +{ m_bDeleted = true; Hide(); - m_aScrollWindow.Hide(); + m_aScrollWindow->Hide(); m_aMarkIdle.Stop(); if ( m_pPropWin ) { notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - ::std::unique_ptr<vcl::Window> aTemp2(m_pPropWin); - m_pPropWin = NULL; } if ( m_pAddField ) { SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) ); aDlgOpt.SetWindowState(OStringToOUString(m_pAddField->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US)); notifySystemWindow(this,m_pAddField,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - ::std::unique_ptr<vcl::Window> aTemp2(m_pAddField); - m_pAddField = NULL; } if ( m_pReportExplorer ) { SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(m_pReportExplorer->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US)); notifySystemWindow(this,m_pReportExplorer,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); - ::std::unique_ptr<vcl::Window> aTemp2(m_pReportExplorer); - m_pReportExplorer = NULL; - } - { - ::std::unique_ptr<vcl::Window> aTemp2(m_pTaskPane); - m_pTaskPane = NULL; } + + m_aSplitWin.disposeAndClear(); + m_aScrollWindow.disposeAndClear(); + m_pTaskPane.clear(); + m_pReportExplorer.clear(); + m_pPropWin.clear(); + m_pAddField.clear(); + dbaui::ODataView::dispose(); } void ODesignView::initialize() { SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aScrollWindow.initialize(); - m_aScrollWindow.Show(); + m_aScrollWindow->initialize(); + m_aScrollWindow->Show(); } void ODesignView::DataChanged( const DataChangedEvent& rDCEvt ) @@ -197,7 +202,7 @@ bool ODesignView::PreNotify( NotifyEvent& rNEvt ) const vcl::KeyCode& rCode = pKeyEvent->GetKeyCode(); util::URL aUrl; aUrl.Complete = m_pAccel->findCommand(svt::AcceleratorExecute::st_VCLKey2AWTKey(rCode)); - if ( aUrl.Complete.isEmpty() || !m_rController.isCommandEnabled( aUrl.Complete ) ) + if ( aUrl.Complete.isEmpty() || !m_xController->isCommandEnabled( aUrl.Complete ) ) nRet = false; } } @@ -231,7 +236,7 @@ void ODesignView::resizeDocumentView(Rectangle& _rPlayground) } } - if ( m_aSplitWin.IsItemValid(TASKPANE_ID) ) + if ( m_aSplitWin->IsItemValid(TASKPANE_ID) ) { // normalize the split pos const long nSplitterWidth = GetSettings().GetStyleSettings().GetSplitSize(); @@ -248,15 +253,15 @@ void ODesignView::resizeDocumentView(Rectangle& _rPlayground) getController().setSplitPos(nSplitPos); const long nTaskPaneSize = static_cast<long>((aPlaygroundSize.Width() - aTaskPanePos.X())*100/aPlaygroundSize.Width()); - if ( m_aSplitWin.GetItemSize( TASKPANE_ID ) != nTaskPaneSize ) + if ( m_aSplitWin->GetItemSize( TASKPANE_ID ) != nTaskPaneSize ) { - m_aSplitWin.SetItemSize( REPORT_ID, 99 - nTaskPaneSize ); - m_aSplitWin.SetItemSize( TASKPANE_ID, nTaskPaneSize ); + m_aSplitWin->SetItemSize( REPORT_ID, 99 - nTaskPaneSize ); + m_aSplitWin->SetItemSize( TASKPANE_ID, nTaskPaneSize ); } } } // set the size of the report window - m_aSplitWin.SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize ); + m_aSplitWin->SetPosSizePixel( _rPlayground.TopLeft(),aPlaygroundSize ); } // just for completeness: there is no space left, we occupied it all ... _rPlayground.SetPos( _rPlayground.BottomRight() ); @@ -273,7 +278,7 @@ IMPL_LINK_NOARG(ODesignView, MarkTimeout) if ( xProp.is() ) { m_pPropWin->Update(xProp); - static_cast<OTaskWindow*>(m_pTaskPane)->Resize(); + static_cast<OTaskWindow*>(m_pTaskPane.get())->Resize(); } Resize(); } @@ -288,18 +293,18 @@ void ODesignView::SetMode( DlgEdMode _eNewMode ) if ( m_eMode == RPTUI_SELECT ) m_eActObj = OBJ_NONE; - m_aScrollWindow.SetMode(_eNewMode); + m_aScrollWindow->SetMode(_eNewMode); } void ODesignView::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType ) { m_eActObj = eObj; - m_aScrollWindow.SetInsertObj( eObj,_sShapeType ); + m_aScrollWindow->SetInsertObj( eObj,_sShapeType ); } OUString ODesignView::GetInsertObjString() const { - return m_aScrollWindow.GetInsertObjString(); + return m_aScrollWindow->GetInsertObjString(); } @@ -315,30 +320,30 @@ void ODesignView::Cut() void ODesignView::Copy() { - m_aScrollWindow.Copy(); + m_aScrollWindow->Copy(); } void ODesignView::Paste() { - m_aScrollWindow.Paste(); + m_aScrollWindow->Paste(); } void ODesignView::Delete() { - m_aScrollWindow.Delete(); + m_aScrollWindow->Delete(); } bool ODesignView::HasSelection() const { - return m_aScrollWindow.HasSelection(); + return m_aScrollWindow->HasSelection(); } bool ODesignView::IsPasteAllowed() const { - return m_aScrollWindow.IsPasteAllowed(); + return m_aScrollWindow->IsPasteAllowed(); } @@ -347,10 +352,10 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView) if ( m_pCurrentView != &_rView ) { if ( m_pCurrentView ) - m_aScrollWindow.setMarked(m_pCurrentView,false); + m_aScrollWindow->setMarked(m_pCurrentView,false); m_pCurrentView = &_rView; if ( m_pCurrentView ) - m_aScrollWindow.setMarked(m_pCurrentView,true); + m_aScrollWindow->setMarked(m_pCurrentView,true); m_xReportComponent.clear(); DlgEdHint aHint( RPTUI_HINT_SELECTIONCHANGED ); Broadcast( aHint ); @@ -361,27 +366,27 @@ void ODesignView::UpdatePropertyBrowserDelayed(OSectionView& _rView) void ODesignView::toggleGrid(bool _bGridVisible) { - m_aScrollWindow.toggleGrid(_bGridVisible); + m_aScrollWindow->toggleGrid(_bGridVisible); } sal_uInt16 ODesignView::getSectionCount() const { - return m_aScrollWindow.getSectionCount(); + return m_aScrollWindow->getSectionCount(); } void ODesignView::showRuler(bool _bShow) { - m_aScrollWindow.showRuler(_bShow); + m_aScrollWindow->showRuler(_bShow); } void ODesignView::removeSection(sal_uInt16 _nPosition) { - m_aScrollWindow.removeSection(_nPosition); + m_aScrollWindow->removeSection(_nPosition); } void ODesignView::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition) { - m_aScrollWindow.addSection(_xSection,_sColorEntry,_nPosition); + m_aScrollWindow->addSection(_xSection,_sColorEntry,_nPosition); } void ODesignView::GetFocus() @@ -390,7 +395,7 @@ void ODesignView::GetFocus() if ( !m_bDeleted ) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection(); + OSectionWindow* pSectionWindow = m_aScrollWindow->getMarkedSection(); if ( pSectionWindow ) pSectionWindow->GrabFocus(); } @@ -406,12 +411,12 @@ void ODesignView::ImplInitSettings() IMPL_LINK( ODesignView, SplitHdl, void*, ) { const Size aOutputSize = GetOutputSizePixel(); - const long nTest = aOutputSize.Width() * m_aSplitWin.GetItemSize(TASKPANE_ID) / 100; + const long nTest = aOutputSize.Width() * m_aSplitWin->GetItemSize(TASKPANE_ID) / 100; long nMinWidth = static_cast<long>(0.1*aOutputSize.Width()); if ( m_pPropWin && m_pPropWin->IsVisible() ) nMinWidth = m_pPropWin->GetMinOutputSizePixel().Width(); - if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow.getMaxMarkerWidth(false) ) + if ( (aOutputSize.Width() - nTest) >= nMinWidth && nTest > m_aScrollWindow->getMaxMarkerWidth(false) ) { long nOldSplitPos = getController().getSplitPos(); (void)nOldSplitPos; @@ -423,21 +428,21 @@ IMPL_LINK( ODesignView, SplitHdl, void*, ) void ODesignView::SelectAll(const sal_uInt16 _nObjectType) { - m_aScrollWindow.SelectAll(_nObjectType); + m_aScrollWindow->SelectAll(_nObjectType); } void ODesignView::unmarkAllObjects(OSectionView* _pSectionView) { - m_aScrollWindow.unmarkAllObjects(_pSectionView); + m_aScrollWindow->unmarkAllObjects(_pSectionView); } void ODesignView::togglePropertyBrowser(bool _bToogleOn) { if ( !m_pPropWin && _bToogleOn ) { - m_pPropWin = new PropBrw(getController().getORB(), m_pTaskPane,this); + m_pPropWin = VclPtr<PropBrw>::Create(getController().getORB(), m_pTaskPane,this); m_pPropWin->Invalidate(); - static_cast<OTaskWindow*>(m_pTaskPane)->setPropertyBrowser(m_pPropWin); + static_cast<OTaskWindow*>(m_pTaskPane.get())->setPropertyBrowser(m_pPropWin); notifySystemWindow(this,m_pPropWin,::comphelper::mem_fun(&TaskPaneList::AddWindow)); } if ( m_pPropWin && _bToogleOn != m_pPropWin->IsVisible() ) @@ -451,9 +456,9 @@ void ODesignView::togglePropertyBrowser(bool _bToogleOn) m_pTaskPane->Invalidate(); if ( bWillBeVisible ) - m_aSplitWin.InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); + m_aSplitWin->InsertItem( TASKPANE_ID, m_pTaskPane,START_SIZE_TASKPANE, SPLITWINDOW_APPEND, COLSET_ID, SWIB_PERCENTSIZE); else - m_aSplitWin.RemoveItem(TASKPANE_ID); + m_aSplitWin->RemoveItem(TASKPANE_ID); if ( bWillBeVisible ) m_aMarkIdle.Start(); @@ -466,7 +471,7 @@ void ODesignView::showProperties(const uno::Reference< uno::XInterface>& _xRepor { m_xReportComponent = _xReportComponent; if ( m_pCurrentView ) - m_aScrollWindow.setMarked(m_pCurrentView,false); + m_aScrollWindow->setMarked(m_pCurrentView,false); m_pCurrentView = NULL; m_aMarkIdle.Start(); } @@ -482,7 +487,7 @@ void ODesignView::toggleReportExplorer() if ( !m_pReportExplorer ) { OReportController& rReportController = getController(); - m_pReportExplorer = new ONavigator(this,rReportController); + m_pReportExplorer = VclPtr<ONavigator>::Create(this,rReportController); SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pReportExplorer->GetHelpId(), RTL_TEXTENCODING_UTF8)); if ( aDlgOpt.Exists() ) m_pReportExplorer->SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US)); @@ -518,7 +523,7 @@ void ODesignView::toggleAddField() xReport = xSection->getReportDefinition(); } uno::Reference < beans::XPropertySet > xSet(rReportController.getRowSet(),uno::UNO_QUERY); - m_pAddField = new OAddFieldWindow(this,xSet); + m_pAddField = VclPtr<OAddFieldWindow>::Create(this,xSet); m_pAddField->SetCreateHdl(LINK( &rReportController, OReportController, OnCreateHdl ) ); SvtViewOptions aDlgOpt( E_WINDOW, OUString( UID_RPT_RPT_APP_VIEW ) ); if ( aDlgOpt.Exists() ) @@ -551,29 +556,29 @@ uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() return xModel; } -::boost::shared_ptr<OSectionWindow> ODesignView::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* ODesignView::getMarkedSection(NearSectionAccess nsa) const { - return m_aScrollWindow.getMarkedSection(nsa); + return m_aScrollWindow->getMarkedSection(nsa); } -::boost::shared_ptr<OSectionWindow> ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* ODesignView::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { - return m_aScrollWindow.getSectionWindow(_xSection); + return m_aScrollWindow->getSectionWindow(_xSection); } void ODesignView::markSection(const sal_uInt16 _nPos) { - m_aScrollWindow.markSection(_nPos); + m_aScrollWindow->markSection(_nPos); } void ODesignView::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const { - m_aScrollWindow.fillCollapsedSections(_rCollapsedPositions); + m_aScrollWindow->fillCollapsedSections(_rCollapsedPositions); } void ODesignView::collapseSections(const uno::Sequence< beans::PropertyValue>& _aCollpasedSections) { - m_aScrollWindow.collapseSections(_aCollpasedSections); + m_aScrollWindow->collapseSections(_aCollpasedSections); } OUString ODesignView::getCurrentPage() const @@ -589,7 +594,7 @@ void ODesignView::setCurrentPage(const OUString& _sLastActivePage) void ODesignView::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) { - m_aScrollWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects); + m_aScrollWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection,bBoundRects); } bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent) @@ -600,12 +605,12 @@ bool ODesignView::handleKeyEvent(const KeyEvent& _rEvent) return false; if ( (m_pReportExplorer && m_pReportExplorer->HasChildPathFocus()) ) return false; - return m_aScrollWindow.handleKeyEvent(_rEvent); + return m_aScrollWindow->handleKeyEvent(_rEvent); } void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,bool _bMark) { - m_aScrollWindow.setMarked(_xSection,_bMark); + m_aScrollWindow->setMarked(_xSection,_bMark); if ( _bMark ) UpdatePropertyBrowserDelayed(getMarkedSection()->getReportSection().getSectionView()); else @@ -614,7 +619,7 @@ void ODesignView::setMarked(const uno::Reference< report::XSection>& _xSection,b void ODesignView::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _aShapes,bool _bMark) { - m_aScrollWindow.setMarked(_aShapes,_bMark); + m_aScrollWindow->setMarked(_aShapes,_bMark); if ( _aShapes.hasElements() && _bMark ) showProperties(_aShapes[0]); else @@ -634,7 +639,7 @@ void ODesignView::MouseButtonDown( const MouseEvent& rMEvt ) uno::Any ODesignView::getCurrentlyShownProperty() const { uno::Any aRet; - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getMarkedSection(); + OSectionWindow* pSectionWindow = getMarkedSection(); if ( pSectionWindow ) { ::std::vector< uno::Reference< uno::XInterface > > aSelection; @@ -655,18 +660,18 @@ uno::Any ODesignView::getCurrentlyShownProperty() const void ODesignView::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const { - m_aScrollWindow.fillControlModelSelection(_rSelection); + m_aScrollWindow->fillControlModelSelection(_rSelection); } void ODesignView::setGridSnap(bool bOn) { - m_aScrollWindow.setGridSnap(bOn); + m_aScrollWindow->setGridSnap(bOn); } void ODesignView::setDragStripes(bool bOn) { - m_aScrollWindow.setDragStripes(bOn); + m_aScrollWindow->setDragStripes(bOn); } bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const @@ -676,17 +681,17 @@ bool ODesignView::isHandleEvent(sal_uInt16 /*_nId*/) const sal_uInt32 ODesignView::getMarkedObjectCount() const { - return m_aScrollWindow.getMarkedObjectCount(); + return m_aScrollWindow->getMarkedObjectCount(); } void ODesignView::zoom(const Fraction& _aZoom) { - m_aScrollWindow.zoom(_aZoom); + m_aScrollWindow->zoom(_aZoom); } sal_uInt16 ODesignView::getZoomFactor(SvxZoomType _eType) const { - return m_aScrollWindow.getZoomFactor(_eType); + return m_aScrollWindow->getZoomFactor(_eType); } } // rptui diff --git a/reportdesign/source/ui/report/FixedTextColor.cxx b/reportdesign/source/ui/report/FixedTextColor.cxx index ca3029b0ad31..8ccfc48ac682 100644 --- a/reportdesign/source/ui/report/FixedTextColor.cxx +++ b/reportdesign/source/ui/report/FixedTextColor.cxx @@ -172,7 +172,7 @@ namespace rptui OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject); if ( pUnoObj ) // this doesn't need to be done for shapes { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = pController->getSectionWindow(xSection); + OSectionWindow* pSectionWindow = pController->getSectionWindow(xSection); if (pSectionWindow != 0) { OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice diff --git a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx index a2ca68daba83..1255d686fe23 100644 --- a/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx +++ b/reportdesign/source/ui/report/FormattedFieldBeautifier.cxx @@ -173,7 +173,7 @@ namespace rptui OUnoObject* pUnoObj = dynamic_cast<OUnoObject*>(pObject); if ( pUnoObj ) // this doesn't need to be done for shapes { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_rReportController.getSectionWindow(xSection); + OSectionWindow* pSectionWindow = m_rReportController.getSectionWindow(xSection); if (pSectionWindow != 0) { OReportSection& aOutputDevice = pSectionWindow->getReportSection(); // OutputDevice diff --git a/reportdesign/source/ui/report/ReportController.cxx b/reportdesign/source/ui/report/ReportController.cxx index bd7f17eb582a..24f274ee56dd 100644 --- a/reportdesign/source/ui/report/ReportController.cxx +++ b/reportdesign/source/ui/report/ReportController.cxx @@ -339,7 +339,6 @@ void OReportController::disposing() { SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8)); aDlgOpt.SetWindowState(OStringToOUString(m_pGroupsFloater->GetWindowState(WINDOWSTATE_MASK_ALL), RTL_TEXTENCODING_ASCII_US)); - ::std::unique_ptr<FloatingWindow> aTemp(m_pGroupsFloater); m_pGroupsFloater = NULL; } @@ -362,7 +361,7 @@ void OReportController::disposing() { try { - ::boost::shared_ptr<OSectionWindow> pSectionWindow; + OSectionWindow* pSectionWindow = NULL; if ( getDesignView() ) pSectionWindow = getDesignView()->getMarkedSection(); if ( pSectionWindow ) @@ -583,7 +582,7 @@ FeatureState OReportController::GetState(sal_uInt16 _nId) const aReturn.bEnabled = isEditable() && getDesignView()->HasSelection() && !getDesignView()->isHandleEvent(_nId); if ( aReturn.bEnabled ) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); if ( pSectionWindow ) aReturn.bEnabled = !pSectionWindow->getReportSection().isUiActive(); } @@ -1135,7 +1134,7 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > break; case SID_TERMINATE_INPLACEACTIVATION: { - ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection(); + OSectionWindow* pSection = getDesignView()->getMarkedSection(); if ( pSection ) pSection->getReportSection().deactivateOle(); } @@ -1568,8 +1567,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > uno::Reference< report::XFormattedField> xFormattedField(getDesignView()->getCurrentControlModel(),uno::UNO_QUERY); if ( xFormattedField.is() ) { - ConditionalFormattingDialog aDlg( getView(), xFormattedField.get(), *this ); - aDlg.Execute(); + ScopedVclPtrInstance< ConditionalFormattingDialog > aDlg( getView(), xFormattedField.get(), *this ); + aDlg->Execute(); } } break; @@ -1578,8 +1577,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > { if ( !aArgs.getLength() ) { - ODateTimeDialog aDlg(getView(),getDesignView()->getCurrentSection(),this); - aDlg.Execute(); + ScopedVclPtrInstance< ODateTimeDialog > aDlg(getView(),getDesignView()->getCurrentSection(),this); + aDlg->Execute(); } else createDateTime(aArgs); @@ -1590,8 +1589,8 @@ void OReportController::Execute(sal_uInt16 _nId, const Sequence< PropertyValue > { if ( !aArgs.getLength() ) { - OPageNumberDialog aDlg(getView(),m_xReportDefinition,this); - aDlg.Execute(); + ScopedVclPtrInstance< OPageNumberDialog > aDlg(getView(),m_xReportDefinition,this); + aDlg->Execute(); } else createPageNumber(aArgs); @@ -1783,9 +1782,9 @@ void OReportController::doOpenHelpAgent() bool OReportController::Construct(vcl::Window* pParent) { - ODesignView* pMyOwnView = new ODesignView( pParent, m_xContext, *this ); + VclPtrInstance<ODesignView> pMyOwnView( pParent, m_xContext, *this ); StartListening( *pMyOwnView ); - setView( *pMyOwnView ); + setView( pMyOwnView ); // now that we have a view we can create the clipboard listener m_aSystemClipboard = TransferableDataHelper::CreateFromSystemClipboard( getView() ); @@ -2481,15 +2480,16 @@ void OReportController::openPageDialog(const uno::Reference<report::XSection>& _ } { // want the dialog to be destroyed before our set - ORptPageDialog aDlg(getView(), pDescriptor.get(),_xSection.is() - ? OUString("BackgroundDialog") - : OUString("PageDialog")); - if (RET_OK == aDlg.Execute()) + ScopedVclPtrInstance<ORptPageDialog> aDlg( + getView(), pDescriptor.get(),_xSection.is() + ? OUString("BackgroundDialog") + : OUString("PageDialog")); + if (RET_OK == aDlg->Execute()) { // ItemSet->UNO // UNO-properties - const SfxItemSet* pSet = aDlg.GetOutputItemSet(); + const SfxItemSet* pSet = aDlg->GetOutputItemSet(); if ( _xSection.is() ) { const SfxPoolItem* pItem; @@ -2578,7 +2578,7 @@ void OReportController::openSortingAndGroupingDialog() return; if ( !m_pGroupsFloater ) { - m_pGroupsFloater = new OGroupsSortingDialog(getView(),!isEditable(),this); + m_pGroupsFloater = VclPtr<OGroupsSortingDialog>::Create(getView(),!isEditable(),this); SvtViewOptions aDlgOpt(E_WINDOW, OStringToOUString(m_pGroupsFloater->GetHelpId(), RTL_TEXTENCODING_UTF8)); if ( aDlgOpt.Exists() ) m_pGroupsFloater->SetWindowState(OUStringToOString(aDlgOpt.GetWindowState(), RTL_TEXTENCODING_ASCII_US)); @@ -2791,8 +2791,8 @@ uno::Any SAL_CALL OReportController::getViewData() throw( uno::RuntimeException, aViewData.put( "CollapsedSections", aCollapsedSections ); } - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); - if ( pSectionWindow.get() ) + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); + if ( pSectionWindow ) { aViewData.put( "MarkedSection", (sal_Int32)pSectionWindow->getReportSection().getPage()->GetPageNum() ); } @@ -3159,7 +3159,7 @@ void OReportController::createControl(const Sequence< PropertyValue >& _aArgs,co { SequenceAsHashMap aMap(_aArgs); getDesignView()->setMarked(_xSection, true); - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); if ( !pSectionWindow ) return; @@ -3337,7 +3337,7 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) getDesignView()->unmarkAllObjects(NULL); // Anhand des FormatKeys wird festgestellt, welches Feld benoetigt wird - ::boost::shared_ptr<OSectionWindow> pSectionWindow[2]; + OSectionWindow* pSectionWindow[2]; pSectionWindow[0] = getDesignView()->getMarkedSection(); if ( !pSectionWindow[0] ) @@ -3651,8 +3651,8 @@ void OReportController::addPairControls(const Sequence< PropertyValue >& aArgs) OSectionView* OReportController::getCurrentSectionView() const { OSectionView* pSectionView = NULL; - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getDesignView()->getMarkedSection(); - if ( pSectionWindow.get() ) + OSectionWindow* pSectionWindow = getDesignView()->getMarkedSection(); + if ( pSectionWindow ) pSectionView = &pSectionWindow->getReportSection().getSectionView(); return pSectionView; } @@ -3966,7 +3966,7 @@ void OReportController::createGroupSection(const bool _bUndo,const bool _bHeader void OReportController::collapseSection(const bool _bCollapse) { - ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection(); + OSectionWindow *pSection = getDesignView()->getMarkedSection(); if ( pSection ) { pSection->setCollapsed(_bCollapse); @@ -3975,10 +3975,10 @@ void OReportController::collapseSection(const bool _bCollapse) void OReportController::markSection(const bool _bNext) { - ::boost::shared_ptr<OSectionWindow> pSection = getDesignView()->getMarkedSection(); + OSectionWindow *pSection = getDesignView()->getMarkedSection(); if ( pSection ) { - ::boost::shared_ptr<OSectionWindow> pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS); + OSectionWindow *pPrevSection = getDesignView()->getMarkedSection(_bNext ? POST : PREVIOUS); if ( pPrevSection != pSection && pPrevSection ) select(uno::makeAny(pPrevSection->getReportSection().getSection())); else @@ -4219,16 +4219,15 @@ void OReportController::impl_fillCustomShapeState_nothrow(const char* _pCustomSh } -::boost::shared_ptr<OSectionWindow> OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* OReportController::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { if ( getDesignView() ) { - return getDesignView()->getSectionWindow(_xSection); + return getDesignView()->getSectionWindow(_xSection); } // throw NullPointerException? - ::boost::shared_ptr<OSectionWindow> pEmpty; - return pEmpty; + return NULL; } diff --git a/reportdesign/source/ui/report/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 1a70619ecc33..22a1d986e98d 100644 --- a/reportdesign/source/ui/report/ReportSection.cxx +++ b/reportdesign/source/ui/report/ReportSection.cxx @@ -111,6 +111,11 @@ OReportSection::OReportSection(OSectionWindow* _pParent,const uno::Reference< re OReportSection::~OReportSection() { + disposeOnce(); +} + +void OReportSection::dispose() +{ m_pPage = NULL; if ( m_pMulti.is() ) m_pMulti->dispose(); @@ -125,6 +130,8 @@ OReportSection::~OReportSection() m_pView->EndListening( *m_pModel ); m_pView = NULL; } + m_pParent.clear(); + vcl::Window::dispose(); } void OReportSection::Paint( const Rectangle& rRect ) diff --git a/reportdesign/source/ui/report/ReportWindow.cxx b/reportdesign/source/ui/report/ReportWindow.cxx index 74148f6700f3..d43d5584fe8e 100644 --- a/reportdesign/source/ui/report/ReportWindow.cxx +++ b/reportdesign/source/ui/report/ReportWindow.cxx @@ -58,26 +58,26 @@ using namespace ::comphelper; OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView) : Window(_pParent,WB_DIALOGCONTROL) , ::comphelper::OPropertyChangeListener(m_aMutex) -,m_aHRuler(this) +,m_aHRuler(VclPtr<Ruler>::Create(this)) ,m_pView(_pView) ,m_pParent(_pParent) -,m_aViewsWindow(this) +,m_aViewsWindow(VclPtr<rptui::OViewsWindow>::Create(this)) ,m_pObjFac( new DlgEdFactory() ) { SetHelpId(UID_RPT_REPORTWINDOW); SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aViewsWindow.Show(); + m_aViewsWindow->Show(); - m_aHRuler.Show(); - m_aHRuler.Activate(); - m_aHRuler.SetPagePos(0); - m_aHRuler.SetBorders(); - m_aHRuler.SetIndents(); - m_aHRuler.SetMargin1(); - m_aHRuler.SetMargin2(); + m_aHRuler->Show(); + m_aHRuler->Activate(); + m_aHRuler->SetPagePos(0); + m_aHRuler->SetBorders(); + m_aHRuler->SetIndents(); + m_aHRuler->SetMargin1(); + m_aHRuler->SetMargin2(); const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - m_aHRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); + m_aHRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); ImplInitSettings(); m_pReportListener = addStyleListener(_pView->getController().getReportDefinition(),this); @@ -85,31 +85,40 @@ OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView) OReportWindow::~OReportWindow() { + disposeOnce(); +} + +void OReportWindow::dispose() +{ if ( m_pReportListener.is() ) m_pReportListener->dispose(); + m_aHRuler.disposeAndClear(); + m_aViewsWindow.disposeAndClear(); + m_pView.clear(); + m_pParent.clear(); + vcl::Window::dispose(); } void OReportWindow::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType ) { - m_aViewsWindow.SetInsertObj( eObj,_sShapeType); + m_aViewsWindow->SetInsertObj( eObj,_sShapeType); } - OUString OReportWindow::GetInsertObjString() const { - return m_aViewsWindow.GetInsertObjString(); + return m_aViewsWindow->GetInsertObjString(); } void OReportWindow::SetMode( DlgEdMode eNewMode ) { - m_aViewsWindow.SetMode(eNewMode); + m_aViewsWindow->SetMode(eNewMode); } void OReportWindow::removeSection(sal_uInt16 _nPosition) { - m_aViewsWindow.removeSection(_nPosition); + m_aViewsWindow->removeSection(_nPosition); m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight()); - m_aViewsWindow.Invalidate(INVALIDATE_TRANSPARENT); + m_aViewsWindow->Invalidate(INVALIDATE_TRANSPARENT); } void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition) @@ -117,27 +126,27 @@ void OReportWindow::addSection(const uno::Reference< report::XSection >& _xSecti if ( !_xSection.is() ) return; - m_aViewsWindow.addSection(_xSection,_sColorEntry,_nPosition); + m_aViewsWindow->addSection(_xSection,_sColorEntry,_nPosition); m_pParent->setTotalSize(GetTotalWidth(),GetTotalHeight()); } void OReportWindow::toggleGrid(bool _bVisible) { - m_aViewsWindow.toggleGrid(_bVisible); + m_aViewsWindow->toggleGrid(_bVisible); } void OReportWindow::showRuler(bool _bShow) { - m_aHRuler.Show(_bShow); + m_aHRuler->Show(_bShow); - m_aViewsWindow.showRuler(_bShow); + m_aViewsWindow->showRuler(_bShow); } sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const { Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)); - aStartWidth *= m_aViewsWindow.GetMapMode().GetScaleX(); + aStartWidth *= m_aViewsWindow->GetMapMode().GetScaleX(); if ( _bWithEnd ) aStartWidth += Fraction(long(REPORT_ENDMARKER_WIDTH)); return sal_Int32((long)aStartWidth); @@ -146,7 +155,7 @@ sal_Int32 OReportWindow::getMaxMarkerWidth(bool _bWithEnd) const sal_Int32 OReportWindow::GetTotalWidth() const { sal_Int32 nWidth = 0; - if ( !m_aViewsWindow.empty() ) + if ( !m_aViewsWindow->empty() ) { Fraction aStartWidth(long(REPORT_ENDMARKER_WIDTH + REPORT_STARTMARKER_WIDTH )); const Fraction aZoom(m_pView->getController().getZoomValue(),100); @@ -163,7 +172,7 @@ sal_Int32 OReportWindow::GetTotalWidth() const void OReportWindow::Resize() { Window::Resize(); - if ( !m_aViewsWindow.empty() ) + if ( !m_aViewsWindow->empty() ) { const Size aTotalOutputSize = GetOutputSizePixel(); Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH)*m_pView->getController().getZoomValue(),100); @@ -174,26 +183,26 @@ void OReportWindow::Resize() const sal_Int32 nPaperWidth = getStyleProperty<awt::Size>(xReportDefinition,PROPERTY_PAPERSIZE).Width; sal_Int32 nLeftMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_LEFTMARGIN); sal_Int32 nRightMargin = getStyleProperty<sal_Int32>(xReportDefinition,PROPERTY_RIGHTMARGIN); - Size aPageSize = m_aViewsWindow.LogicToPixel(Size(nPaperWidth ,0)); - nLeftMargin = m_aViewsWindow.LogicToPixel(Size(nLeftMargin,0)).Width(); - nRightMargin = m_aViewsWindow.LogicToPixel(Size(nRightMargin,0)).Width(); + Size aPageSize = m_aViewsWindow->LogicToPixel(Size(nPaperWidth ,0)); + nLeftMargin = m_aViewsWindow->LogicToPixel(Size(nLeftMargin,0)).Width(); + nRightMargin = m_aViewsWindow->LogicToPixel(Size(nRightMargin,0)).Width(); - aPageSize.Height() = m_aHRuler.GetSizePixel().Height(); + aPageSize.Height() = m_aHRuler->GetSizePixel().Height(); - const long nTermp(m_aViewsWindow.getTotalHeight() + aPageSize.Height()); + const long nTermp(m_aViewsWindow->getTotalHeight() + aPageSize.Height()); long nSectionsHeight = ::std::max<long>(nTermp,aTotalOutputSize.Height()); - m_aHRuler.SetPosSizePixel(aStartPoint,aPageSize); - m_aHRuler.SetNullOffset(nLeftMargin); - m_aHRuler.SetMargin1(0); - m_aHRuler.SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin); + m_aHRuler->SetPosSizePixel(aStartPoint,aPageSize); + m_aHRuler->SetNullOffset(nLeftMargin); + m_aHRuler->SetMargin1(0); + m_aHRuler->SetMargin2(aPageSize.Width() - nLeftMargin - nRightMargin); aStartPoint.Y() += aPageSize.Height(); nSectionsHeight -= aStartPoint.Y(); aStartPoint.X() = aOffset.X(); - m_aViewsWindow.SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight)); + m_aViewsWindow->SetPosSizePixel(aStartPoint,Size(aTotalOutputSize.Width(),nSectionsHeight)); } } @@ -221,26 +230,26 @@ void OReportWindow::DataChanged( const DataChangedEvent& rDCEvt ) sal_Int32 OReportWindow::GetTotalHeight() const { - return m_aViewsWindow.getTotalHeight(); + return m_aViewsWindow->getTotalHeight(); } void OReportWindow::ScrollChildren(const Point& _aThumbPos) { - MapMode aMap = m_aHRuler.GetMapMode(); + MapMode aMap = m_aHRuler->GetMapMode(); Point aOrg( aMap.GetOrigin() ); if ( aOrg.X() != (-_aThumbPos.X()) ) { aMap.SetOrigin( Point(- _aThumbPos.X(), aOrg.Y())); - m_aHRuler.SetMapMode( aMap ); - m_aHRuler.Scroll(-(aOrg.X() + _aThumbPos.X()),0); + m_aHRuler->SetMapMode( aMap ); + m_aHRuler->Scroll(-(aOrg.X() + _aThumbPos.X()),0); } - m_aViewsWindow.scrollChildren(_aThumbPos); + m_aViewsWindow->scrollChildren(_aThumbPos); } sal_uInt16 OReportWindow::getSectionCount() const { - return m_aViewsWindow.getSectionCount(); + return m_aViewsWindow->getSectionCount(); } void OReportWindow::notifySizeChanged() @@ -250,129 +259,129 @@ void OReportWindow::notifySizeChanged() bool OReportWindow::HasSelection() const { - return m_aViewsWindow.HasSelection(); + return m_aViewsWindow->HasSelection(); } void OReportWindow::Delete() { - m_aViewsWindow.Delete(); + m_aViewsWindow->Delete(); } void OReportWindow::Copy() { - m_aViewsWindow.Copy(); + m_aViewsWindow->Copy(); } void OReportWindow::Paste() { - m_aViewsWindow.Paste(); + m_aViewsWindow->Paste(); } bool OReportWindow::IsPasteAllowed() const { - return m_aViewsWindow.IsPasteAllowed(); + return m_aViewsWindow->IsPasteAllowed(); } void OReportWindow::SelectAll(const sal_uInt16 _nObjectType) { - m_aViewsWindow.SelectAll(_nObjectType); + m_aViewsWindow->SelectAll(_nObjectType); } void OReportWindow::unmarkAllObjects(OSectionView* _pSectionView) { - m_aViewsWindow.unmarkAllObjects(_pSectionView); + m_aViewsWindow->unmarkAllObjects(_pSectionView); } void OReportWindow::showProperties(const uno::Reference< report::XSection>& _xReportComponent) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aViewsWindow.getSectionWindow( _xReportComponent ); + OSectionWindow* pSectionWindow = m_aViewsWindow->getSectionWindow( _xReportComponent ); m_pView->UpdatePropertyBrowserDelayed(pSectionWindow->getReportSection().getSectionView()); } bool OReportWindow::handleKeyEvent(const KeyEvent& _rEvent) { - return m_aViewsWindow.handleKeyEvent(_rEvent); + return m_aViewsWindow->handleKeyEvent(_rEvent); } void OReportWindow::setMarked(OSectionView* _pSectionView, bool _bMark) { if ( _pSectionView ) - m_aViewsWindow.setMarked(_pSectionView,_bMark); + m_aViewsWindow->setMarked(_pSectionView,_bMark); } void OReportWindow::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark) { - m_aViewsWindow.setMarked(_xSection,_bMark); + m_aViewsWindow->setMarked(_xSection,_bMark); } void OReportWindow::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape, bool _bMark) { - m_aViewsWindow.setMarked(_xShape,_bMark); + m_aViewsWindow->setMarked(_xShape,_bMark); } -::boost::shared_ptr<OSectionWindow> OReportWindow::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* OReportWindow::getMarkedSection(NearSectionAccess nsa) const { - return m_aViewsWindow.getMarkedSection(nsa); + return m_aViewsWindow->getMarkedSection(nsa); } -::boost::shared_ptr<OSectionWindow> OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* OReportWindow::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { - return m_aViewsWindow.getSectionWindow(_xSection); + return m_aViewsWindow->getSectionWindow(_xSection); } void OReportWindow::markSection(const sal_uInt16 _nPos) { - m_aViewsWindow.markSection(_nPos); + m_aViewsWindow->markSection(_nPos); } void OReportWindow::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const { - m_aViewsWindow.fillCollapsedSections(_rCollapsedPositions); + m_aViewsWindow->fillCollapsedSections(_rCollapsedPositions); } void OReportWindow::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections) { - m_aViewsWindow.collapseSections(_aCollpasedSections); + m_aViewsWindow->collapseSections(_aCollpasedSections); } void OReportWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) { - m_aViewsWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); + m_aViewsWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); } void OReportWindow::setGridSnap(bool bOn) { - m_aViewsWindow.setGridSnap(bOn); + m_aViewsWindow->setGridSnap(bOn); } void OReportWindow::setDragStripes(bool bOn) { - m_aViewsWindow.setDragStripes(bOn); + m_aViewsWindow->setDragStripes(bOn); } sal_uInt32 OReportWindow::getMarkedObjectCount() const { - return m_aViewsWindow.getMarkedObjectCount(); + return m_aViewsWindow->getMarkedObjectCount(); } void OReportWindow::zoom(const Fraction& _aZoom) { - m_aHRuler.SetZoom(_aZoom); - m_aHRuler.Invalidate(); + m_aHRuler->SetZoom(_aZoom); + m_aHRuler->Invalidate(); - m_aViewsWindow.zoom(_aZoom); + m_aViewsWindow->zoom(_aZoom); notifySizeChanged(); const Point aNewThumbPos( m_pParent->getThumbPos() ); @@ -385,7 +394,7 @@ void OReportWindow::zoom(const Fraction& _aZoom) void OReportWindow::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const { - m_aViewsWindow.fillControlModelSelection(_rSelection); + m_aViewsWindow->fillControlModelSelection(_rSelection); } sal_Int32 OReportWindow::impl_getRealPixelWidth() const @@ -411,7 +420,7 @@ sal_uInt16 OReportWindow::getZoomFactor(SvxZoomType _eType) const { nZoom = (sal_uInt16)(long)Fraction(aSize.Width()*100,impl_getRealPixelWidth()); MapMode aMap( MAP_100TH_MM ); - const Size aHeight = m_aViewsWindow.LogicToPixel(m_aViewsWindow.PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler.GetSizePixel().Height())),aMap); + const Size aHeight = m_aViewsWindow->LogicToPixel(m_aViewsWindow->PixelToLogic(Size(0,GetTotalHeight() + m_aHRuler->GetSizePixel().Height())),aMap); nZoom = ::std::min(nZoom,(sal_uInt16)(long)Fraction(aSize.Height()*100,aHeight.Height())); } break; @@ -429,7 +438,7 @@ void OReportWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) { (void)_rEvent; Resize(); - m_aViewsWindow.Resize(); + m_aViewsWindow->Resize(); static sal_Int32 nIn = INVALIDATE_TRANSPARENT; Invalidate(nIn); } diff --git a/reportdesign/source/ui/report/ScrollHelper.cxx b/reportdesign/source/ui/report/ScrollHelper.cxx index d5cf903a4bac..ba789bc9f774 100644 --- a/reportdesign/source/ui/report/ScrollHelper.cxx +++ b/reportdesign/source/ui/report/ScrollHelper.cxx @@ -46,20 +46,20 @@ void lcl_setScrollBar(sal_Int32 _nNewValue,const Point& _aPos,const Size& _aSize OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView) : OScrollWindowHelper_BASE( _pDesignView,WB_DIALOGCONTROL) ,OPropertyChangeListener(m_aMutex) - ,m_aHScroll( this, WB_HSCROLL|WB_REPEAT|WB_DRAG ) - ,m_aVScroll( this, WB_VSCROLL|WB_REPEAT|WB_DRAG ) - ,m_aCornerWin( this ) + ,m_aHScroll( VclPtr<ScrollBar>::Create(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) ) + ,m_aVScroll( VclPtr<ScrollBar>::Create(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) ) + ,m_aCornerWin( VclPtr<ScrollBarBox>::Create(this) ) ,m_pParent(_pDesignView) - ,m_aReportWindow(this,m_pParent) + ,m_aReportWindow(VclPtr<rptui::OReportWindow>::Create(this,m_pParent)) ,m_pReportDefintionMultiPlexer(NULL) { SetMapMode( MapMode( MAP_100TH_MM ) ); - impl_initScrollBar( m_aHScroll ); - impl_initScrollBar( m_aVScroll ); + impl_initScrollBar( *m_aHScroll.get() ); + impl_initScrollBar( *m_aVScroll.get() ); - m_aReportWindow.SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aReportWindow.Show(); + m_aReportWindow->SetMapMode( MapMode( MAP_100TH_MM ) ); + m_aReportWindow->Show(); // normally we should be SCROLL_PANE SetAccessibleRole(css::accessibility::AccessibleRole::SCROLL_PANE); @@ -69,8 +69,20 @@ OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView) OScrollWindowHelper::~OScrollWindowHelper() { + disposeOnce(); +} + +void OScrollWindowHelper::dispose() +{ if ( m_pReportDefintionMultiPlexer.is() ) m_pReportDefintionMultiPlexer->dispose(); + + m_aHScroll.disposeAndClear(); + m_aVScroll.disposeAndClear(); + m_aCornerWin.disposeAndClear(); + m_aReportWindow.disposeAndClear(); + m_pParent.clear(); + OScrollWindowHelper_BASE::dispose(); } @@ -101,8 +113,8 @@ void OScrollWindowHelper::setTotalSize(sal_Int32 _nWidth ,sal_Int32 _nHeight) // now set the ranges without start marker Fraction aStartWidth(REPORT_STARTMARKER_WIDTH * m_pParent->getController().getZoomValue(),100); long nWidth = long(_nWidth - (double)aStartWidth); - m_aHScroll.SetRangeMax( nWidth ); - m_aVScroll.SetRangeMax( m_aTotalPixelSize.Height() ); + m_aHScroll->SetRangeMax( nWidth ); + m_aVScroll->SetRangeMax( m_aTotalPixelSize.Height() ); Resize(); } @@ -114,7 +126,7 @@ Size OScrollWindowHelper::ResizeScrollBars() if ( aOutPixSz.Width() == 0 || aOutPixSz.Height() == 0 ) return aOutPixSz; - aOutPixSz.Height() -= m_aReportWindow.getRulerHeight(); + aOutPixSz.Height() -= m_aReportWindow->getRulerHeight(); // determine the size of the output-area and if we need scrollbars const long nScrSize = GetSettings().GetStyleSettings().GetScrollBarSize(); bool bVVisible = false; // by default no vertical-ScrollBar @@ -143,31 +155,31 @@ Size OScrollWindowHelper::ResizeScrollBars() } while ( bChanged ); // until no visibility has changed - aOutPixSz.Height() += m_aReportWindow.getRulerHeight(); + aOutPixSz.Height() += m_aReportWindow->getRulerHeight(); // show or hide scrollbars - m_aVScroll.Show( bVVisible ); - m_aHScroll.Show( bHVisible ); + m_aVScroll->Show( bVVisible ); + m_aHScroll->Show( bHVisible ); // disable painting in the corner between the scrollbars if ( bVVisible && bHVisible ) { - m_aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) ); - m_aCornerWin.Show(); + m_aCornerWin->SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) ); + m_aCornerWin->Show(); } else - m_aCornerWin.Hide(); + m_aCornerWin->Hide(); const Point aOffset = LogicToPixel( Point( SECTION_OFFSET, SECTION_OFFSET ), MAP_APPFONT ); // resize scrollbars and set their ranges { Fraction aStartWidth(long(REPORT_STARTMARKER_WIDTH*m_pParent->getController().getZoomValue()),100); const sal_Int32 nNewWidth = aOutPixSz.Width() - aOffset.X() - (long)aStartWidth; - lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ),Size( nNewWidth, nScrSize ),m_aHScroll); + lcl_setScrollBar(nNewWidth,Point( (long)aStartWidth + aOffset.X(), aOutPixSz.Height() ), Size( nNewWidth, nScrSize ), *m_aHScroll.get()); } { - const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow.getRulerHeight(); - lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow.getRulerHeight() ),Size( nScrSize,nNewHeight),m_aVScroll); + const sal_Int32 nNewHeight = aOutPixSz.Height() - m_aReportWindow->getRulerHeight(); + lcl_setScrollBar(nNewHeight,Point( aOutPixSz.Width(), m_aReportWindow->getRulerHeight() ), Size( nScrSize,nNewHeight), *m_aVScroll.get()); } return aOutPixSz; @@ -178,12 +190,12 @@ void OScrollWindowHelper::Resize() OScrollWindowHelper_BASE::Resize(); const Size aTotalOutputSize = ResizeScrollBars(); - m_aReportWindow.SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize); + m_aReportWindow->SetPosSizePixel(Point( 0, 0 ),aTotalOutputSize); } IMPL_LINK( OScrollWindowHelper, ScrollHdl, ScrollBar*, /*pScroll*/ ) { - m_aReportWindow.ScrollChildren( getThumbPos() ); + m_aReportWindow->ScrollChildren( getThumbPos() ); return 0; } @@ -191,127 +203,127 @@ void OScrollWindowHelper::addSection(const uno::Reference< report::XSection >& _ ,const OUString& _sColorEntry ,sal_uInt16 _nPosition) { - m_aReportWindow.addSection(_xSection,_sColorEntry,_nPosition); + m_aReportWindow->addSection(_xSection,_sColorEntry,_nPosition); } void OScrollWindowHelper::removeSection(sal_uInt16 _nPosition) { - m_aReportWindow.removeSection(_nPosition); + m_aReportWindow->removeSection(_nPosition); } void OScrollWindowHelper::toggleGrid(bool _bVisible) { - m_aReportWindow.toggleGrid(_bVisible); + m_aReportWindow->toggleGrid(_bVisible); } sal_uInt16 OScrollWindowHelper::getSectionCount() const { - return m_aReportWindow.getSectionCount(); + return m_aReportWindow->getSectionCount(); } void OScrollWindowHelper::SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType ) { - m_aReportWindow.SetInsertObj(eObj,_sShapeType); + m_aReportWindow->SetInsertObj(eObj,_sShapeType); } OUString OScrollWindowHelper::GetInsertObjString() const { - return m_aReportWindow.GetInsertObjString(); + return m_aReportWindow->GetInsertObjString(); } void OScrollWindowHelper::SetMode( DlgEdMode _eNewMode ) { - m_aReportWindow.SetMode(_eNewMode); + m_aReportWindow->SetMode(_eNewMode); } bool OScrollWindowHelper::HasSelection() const { - return m_aReportWindow.HasSelection(); + return m_aReportWindow->HasSelection(); } void OScrollWindowHelper::Delete() { - m_aReportWindow.Delete(); + m_aReportWindow->Delete(); } void OScrollWindowHelper::Copy() { - m_aReportWindow.Copy(); + m_aReportWindow->Copy(); } void OScrollWindowHelper::Paste() { - m_aReportWindow.Paste(); + m_aReportWindow->Paste(); } bool OScrollWindowHelper::IsPasteAllowed() const { - return m_aReportWindow.IsPasteAllowed(); + return m_aReportWindow->IsPasteAllowed(); } void OScrollWindowHelper::SelectAll(const sal_uInt16 _nObjectType) { - m_aReportWindow.SelectAll(_nObjectType); + m_aReportWindow->SelectAll(_nObjectType); } void OScrollWindowHelper::unmarkAllObjects(OSectionView* _pSectionView) { - m_aReportWindow.unmarkAllObjects(_pSectionView); + m_aReportWindow->unmarkAllObjects(_pSectionView); } sal_Int32 OScrollWindowHelper::getMaxMarkerWidth(bool _bWithEnd) const { - return m_aReportWindow.getMaxMarkerWidth(_bWithEnd); + return m_aReportWindow->getMaxMarkerWidth(_bWithEnd); } void OScrollWindowHelper::showRuler(bool _bShow) { - m_aReportWindow.showRuler(_bShow); + m_aReportWindow->showRuler(_bShow); } bool OScrollWindowHelper::handleKeyEvent(const KeyEvent& _rEvent) { - return m_aReportWindow.handleKeyEvent(_rEvent); + return m_aReportWindow->handleKeyEvent(_rEvent); } void OScrollWindowHelper::setMarked(OSectionView* _pSectionView, bool _bMark) { - m_aReportWindow.setMarked(_pSectionView,_bMark); + m_aReportWindow->setMarked(_pSectionView,_bMark); } void OScrollWindowHelper::setMarked(const uno::Reference< report::XSection>& _xSection, bool _bMark) { - m_aReportWindow.setMarked(_xSection,_bMark); + m_aReportWindow->setMarked(_xSection,_bMark); } void OScrollWindowHelper::setMarked(const uno::Sequence< uno::Reference< report::XReportComponent> >& _xShape, bool _bMark) { - m_aReportWindow.setMarked(_xShape,_bMark); + m_aReportWindow->setMarked(_xShape,_bMark); } -::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* OScrollWindowHelper::getMarkedSection(NearSectionAccess nsa) const { - return m_aReportWindow.getMarkedSection(nsa); + return m_aReportWindow->getMarkedSection(nsa); } -::boost::shared_ptr<OSectionWindow> OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const +OSectionWindow* OScrollWindowHelper::getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const { - return m_aReportWindow.getSectionWindow(_xSection); + return m_aReportWindow->getSectionWindow(_xSection); } void OScrollWindowHelper::markSection(const sal_uInt16 _nPos) { - m_aReportWindow.markSection(_nPos); + m_aReportWindow->markSection(_nPos); } void OScrollWindowHelper::fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const { - m_aReportWindow.fillCollapsedSections(_rCollapsedPositions); + m_aReportWindow->fillCollapsedSections(_rCollapsedPositions); } void OScrollWindowHelper::collapseSections(const uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections) { - m_aReportWindow.collapseSections(_aCollpasedSections); + m_aReportWindow->collapseSections(_aCollpasedSections); } bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt ) @@ -324,11 +336,11 @@ bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt ) { ScrollBar* pHScrBar = NULL; ScrollBar* pVScrBar = NULL; - if ( m_aHScroll.IsVisible() ) - pHScrBar = &m_aHScroll; + if ( m_aHScroll->IsVisible() ) + pHScrBar = m_aHScroll.get(); - if ( m_aVScroll.IsVisible() ) - pVScrBar = &m_aVScroll; + if ( m_aVScroll->IsVisible() ) + pVScrBar = m_aVScroll.get(); if ( HandleScrollCommand( *pCommandEvent, pHScrBar, pVScrBar ) ) return true; @@ -338,7 +350,7 @@ bool OScrollWindowHelper::Notify( NotifyEvent& rNEvt ) void OScrollWindowHelper::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAlignAtSection, bool bBoundRects) { - m_aReportWindow.alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); + m_aReportWindow->alignMarkedObjects(_nControlModification, _bAlignAtSection, bBoundRects); } void OScrollWindowHelper::ImplInitSettings() @@ -363,39 +375,39 @@ void OScrollWindowHelper::DataChanged( const DataChangedEvent& rDCEvt ) void OScrollWindowHelper::_propertyChanged(const beans::PropertyChangeEvent& /*_rEvent*/) throw (uno::RuntimeException, std::exception) { - m_aReportWindow.notifySizeChanged(); + m_aReportWindow->notifySizeChanged(); } void OScrollWindowHelper::setGridSnap(bool bOn) { - m_aReportWindow.setGridSnap(bOn); + m_aReportWindow->setGridSnap(bOn); } void OScrollWindowHelper::setDragStripes(bool bOn) { - m_aReportWindow.setDragStripes(bOn); + m_aReportWindow->setDragStripes(bOn); } sal_uInt32 OScrollWindowHelper::getMarkedObjectCount() const { - return m_aReportWindow.getMarkedObjectCount(); + return m_aReportWindow->getMarkedObjectCount(); } void OScrollWindowHelper::zoom(const Fraction& _aZoom) { - m_aReportWindow.zoom(_aZoom); + m_aReportWindow->zoom(_aZoom); Resize(); Invalidate(INVALIDATE_NOCHILDREN|INVALIDATE_TRANSPARENT); } void OScrollWindowHelper::fillControlModelSelection(::std::vector< uno::Reference< uno::XInterface > >& _rSelection) const { - m_aReportWindow.fillControlModelSelection(_rSelection); + m_aReportWindow->fillControlModelSelection(_rSelection); } sal_uInt16 OScrollWindowHelper::getZoomFactor(SvxZoomType _eType) const { - return m_aReportWindow.getZoomFactor(_eType); + return m_aReportWindow->getZoomFactor(_eType); } } // rptui diff --git a/reportdesign/source/ui/report/SectionWindow.cxx b/reportdesign/source/ui/report/SectionWindow.cxx index b3c50f17b7e6..bb37ceb4cdd4 100644 --- a/reportdesign/source/ui/report/SectionWindow.cxx +++ b/reportdesign/source/ui/report/SectionWindow.cxx @@ -48,35 +48,35 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep : Window( _pParent,WB_DIALOGCONTROL) ,OPropertyChangeListener(m_aMutex) ,m_pParent(_pParent) -,m_aStartMarker( this,_sColorEntry) -,m_aReportSection( this,_xSection) -,m_aSplitter(this) -,m_aEndMarker( this,_sColorEntry) +,m_aStartMarker( VclPtr<rptui::OStartMarker>::Create(this,_sColorEntry)) +,m_aReportSection( VclPtr<rptui::OReportSection>::Create(this,_xSection)) +,m_aSplitter(VclPtr<Splitter>::Create(this)) +,m_aEndMarker( VclPtr<rptui::OEndMarker>::Create(this,_sColorEntry)) { SetUniqueId(UID_RPT_SECTIONSWINDOW); const MapMode& rMapMode = _pParent->GetMapMode(); SetMapMode( rMapMode ); ImplInitSettings(); // TRY - m_aSplitter.SetMapMode( MapMode( MAP_100TH_MM ) ); - m_aSplitter.SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl)); - m_aSplitter.SetSplitHdl(LINK(this, OSectionWindow,SplitHdl)); - m_aSplitter.SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl)); - m_aSplitter.SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); - m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,_xSection->getHeight())).Height()); + m_aSplitter->SetMapMode( MapMode( MAP_100TH_MM ) ); + m_aSplitter->SetStartSplitHdl(LINK(this, OSectionWindow,StartSplitHdl)); + m_aSplitter->SetSplitHdl(LINK(this, OSectionWindow,SplitHdl)); + m_aSplitter->SetEndSplitHdl(LINK(this, OSectionWindow,EndSplitHdl)); + m_aSplitter->SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetFaceColor() )); + m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(Size(0,_xSection->getHeight())).Height()); - m_aStartMarker.setCollapsedHdl(LINK(this,OSectionWindow,Collapsed)); + m_aStartMarker->setCollapsedHdl(LINK(this,OSectionWindow,Collapsed)); - m_aStartMarker.zoom(rMapMode.GetScaleX()); - setZoomFactor(rMapMode.GetScaleX(),m_aReportSection); - setZoomFactor(rMapMode.GetScaleX(),m_aSplitter); - setZoomFactor(rMapMode.GetScaleX(),m_aEndMarker); + m_aStartMarker->zoom(rMapMode.GetScaleX()); + setZoomFactor(rMapMode.GetScaleX(), *m_aReportSection.get()); + setZoomFactor(rMapMode.GetScaleX(), *m_aSplitter.get()); + setZoomFactor(rMapMode.GetScaleX(), *m_aEndMarker.get()); - m_aSplitter.Show(); - m_aStartMarker.Show(); - m_aReportSection.Show(); - m_aEndMarker.Show(); + m_aSplitter->Show(); + m_aStartMarker->Show(); + m_aReportSection->Show(); + m_aEndMarker->Show(); Show(); m_pSectionMulti = new OPropertyChangeMultiplexer(this,_xSection.get()); @@ -100,6 +100,11 @@ OSectionWindow::OSectionWindow( OViewsWindow* _pParent,const uno::Reference< rep OSectionWindow::~OSectionWindow() { + disposeOnce(); +} + +void OSectionWindow::dispose() +{ try { if ( m_pSectionMulti.is() ) @@ -110,6 +115,12 @@ OSectionWindow::~OSectionWindow() catch (uno::Exception&) { } + m_aStartMarker.disposeAndClear(); + m_aReportSection.disposeAndClear(); + m_aSplitter.disposeAndClear(); + m_aEndMarker.disposeAndClear(); + m_pParent.clear(); + vcl::Window::dispose(); } void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) @@ -119,7 +130,7 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) const uno::Reference< report::XSection > xSection(_rEvent.Source,uno::UNO_QUERY); if ( xSection.is() ) { - const uno::Reference< report::XSection> xCurrentSection = m_aReportSection.getSection(); + const uno::Reference< report::XSection> xCurrentSection = m_aReportSection->getSection(); if ( _rEvent.PropertyName == PROPERTY_HEIGHT ) { m_pParent->getView()->SetUpdateMode(false); @@ -137,13 +148,13 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) || setReportSectionTitle(xReport,RID_STR_PAGE_HEADER,::std::mem_fun(&OReportHelper::getPageHeader),::std::mem_fun(&OReportHelper::getPageHeaderOn)) || setReportSectionTitle(xReport,RID_STR_PAGE_FOOTER,::std::mem_fun(&OReportHelper::getPageFooter),::std::mem_fun(&OReportHelper::getPageFooterOn)) ) { - m_aStartMarker.Invalidate(INVALIDATE_NOERASE); + m_aStartMarker->Invalidate(INVALIDATE_NOERASE); } else { OUString sTitle = ModuleRes(RID_STR_DETAIL); - m_aStartMarker.setTitle(sTitle); - m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); + m_aStartMarker->setTitle(sTitle); + m_aStartMarker->Invalidate(INVALIDATE_CHILDREN); } } } @@ -160,12 +171,12 @@ void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReportDefinition>& _xReport,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OReportHelper> _pGetSection, const ::std::mem_fun_t<bool,OReportHelper>& _pIsSectionOn) { OReportHelper aReportHelper(_xReport); - const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection.getSection(); + const bool bRet = _pIsSectionOn(&aReportHelper) && _pGetSection(&aReportHelper) == m_aReportSection->getSection(); if ( bRet ) { OUString sTitle = ModuleRes(_nResId); - m_aStartMarker.setTitle(sTitle); - m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); + m_aStartMarker->setTitle(sTitle); + m_aStartMarker->Invalidate(INVALIDATE_CHILDREN); } return bRet; } @@ -173,7 +184,7 @@ bool OSectionWindow::setReportSectionTitle(const uno::Reference< report::XReport bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& _xGroup,sal_uInt16 _nResId,::std::mem_fun_t<uno::Reference<report::XSection> , OGroupHelper> _pGetSection, const ::std::mem_fun_t<bool,OGroupHelper>& _pIsSectionOn) { OGroupHelper aGroupHelper(_xGroup); - const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection.getSection() ; + const bool bRet = _pIsSectionOn(&aGroupHelper) && _pGetSection(&aGroupHelper) == m_aReportSection->getSection() ; if ( bRet ) { OUString sExpression = _xGroup->getExpression(); @@ -185,8 +196,8 @@ bool OSectionWindow::setGroupSectionTitle(const uno::Reference< report::XGroup>& OUString sTitle( ModuleRes(_nResId).toString() ); sTitle = sTitle.replaceFirst("#", sExpression); - m_aStartMarker.setTitle( sTitle ); - m_aStartMarker.Invalidate(INVALIDATE_CHILDREN); + m_aStartMarker->setTitle( sTitle ); + m_aStartMarker->Invalidate(INVALIDATE_CHILDREN); } return bRet; } @@ -225,12 +236,12 @@ void OSectionWindow::Resize() const Point aThumbPos = m_pParent->getView()->getThumbPos(); aOutputSize.Width() -= aThumbPos.X(); - aOutputSize.Height() -= m_aSplitter.GetSizePixel().Height(); + aOutputSize.Height() -= m_aSplitter->GetSizePixel().Height(); - if ( m_aStartMarker.isCollapsed() ) + if ( m_aStartMarker->isCollapsed() ) { Point aPos(0,0); - m_aStartMarker.SetPosSizePixel(aPos,aOutputSize); + m_aStartMarker->SetPosSizePixel(aPos,aOutputSize); } else { @@ -240,49 +251,49 @@ void OSectionWindow::Resize() aStartWidth *= GetMapMode().GetScaleX(); // set start marker - m_aStartMarker.SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height())); + m_aStartMarker->SetPosSizePixel(Point(0,0),Size(aStartWidth,aOutputSize.Height())); // set report section - const uno::Reference< report::XSection> xSection = m_aReportSection.getSection(); + const uno::Reference< report::XSection> xSection = m_aReportSection->getSection(); Size aSectionSize = LogicToPixel( Size( 0,xSection->getHeight() ) ); Point aReportPos(aStartWidth,0); aSectionSize.Width() = aOutputSize.Width() - (long)aStartWidth; if ( bShowEndMarker ) aSectionSize.Width() -= (long)aEndWidth; - m_aReportSection.SetPosSizePixel(aReportPos,aSectionSize); + m_aReportSection->SetPosSizePixel(aReportPos,aSectionSize); // set splitter aReportPos.Y() += aSectionSize.Height(); - m_aSplitter.SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter.GetSizePixel().Height())); + m_aSplitter->SetPosSizePixel(aReportPos,Size(aSectionSize.Width(),m_aSplitter->GetSizePixel().Height())); aSectionSize.Height() = (long)(1000 * (double)GetMapMode().GetScaleY()); - m_aSplitter.SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize)); + m_aSplitter->SetDragRectPixel( Rectangle(Point(aStartWidth,0),aSectionSize)); // set end marker aReportPos.X() += aSectionSize.Width(); aReportPos.Y() = 0; - m_aEndMarker.Show(bShowEndMarker); - m_aEndMarker.SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height())); + m_aEndMarker->Show(bShowEndMarker); + m_aEndMarker->SetPosSizePixel(aReportPos,Size(aEndWidth,aOutputSize.Height())); } } void OSectionWindow::setCollapsed(bool _bCollapsed) { - if ( m_aStartMarker.isCollapsed() != _bCollapsed ) + if ( m_aStartMarker->isCollapsed() != _bCollapsed ) { - m_aStartMarker.setCollapsed(_bCollapsed); + m_aStartMarker->setCollapsed(_bCollapsed); } } void OSectionWindow::showProperties() { - m_pParent->getView()->showProperties( m_aReportSection.getSection().get() ); + m_pParent->getView()->showProperties( m_aReportSection->getSection().get() ); } void OSectionWindow::setMarked(bool _bMark) { - m_aStartMarker.setMarked(_bMark); - m_aEndMarker.setMarked(_bMark); + m_aStartMarker->setMarked(_bMark); + m_aEndMarker->setMarked(_bMark); } IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) @@ -290,9 +301,9 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) if ( _pMarker ) { bool bShow = !_pMarker->isCollapsed(); - m_aReportSection.Show(bShow); - m_aEndMarker.Show(bShow); - m_aSplitter.Show(bShow); + m_aReportSection->Show(bShow); + m_aEndMarker->Show(bShow); + m_aSplitter->Show(bShow); m_pParent->resize(*this); } @@ -302,11 +313,11 @@ IMPL_LINK( OSectionWindow, Collapsed, OColorListener *, _pMarker ) void OSectionWindow::zoom(const Fraction& _aZoom) { setZoomFactor(_aZoom,*this); - m_aStartMarker.zoom(_aZoom); + m_aStartMarker->zoom(_aZoom); - setZoomFactor(_aZoom,m_aReportSection); - setZoomFactor(_aZoom,m_aSplitter); - setZoomFactor(_aZoom,m_aEndMarker); + setZoomFactor(_aZoom, *m_aReportSection.get()); + setZoomFactor(_aZoom, *m_aSplitter.get()); + setZoomFactor(_aZoom, *m_aEndMarker.get()); Invalidate(); } @@ -332,8 +343,8 @@ IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter ) sal_Int32 nSplitPos = _pSplitter->GetSplitPosPixel(); - const uno::Reference< report::XSection> xSection = m_aReportSection.getSection(); - nSplitPos = m_aSplitter.PixelToLogic(Size(0,nSplitPos)).Height(); + const uno::Reference< report::XSection> xSection = m_aReportSection->getSection(); + nSplitPos = m_aSplitter->PixelToLogic(Size(0,nSplitPos)).Height(); const sal_Int32 nCount = xSection->getCount(); for (sal_Int32 i = 0; i < nCount; ++i) @@ -349,7 +360,7 @@ IMPL_LINK( OSectionWindow, SplitHdl, Splitter*, _pSplitter ) nSplitPos = 0; xSection->setHeight(nSplitPos); - m_aSplitter.SetSplitPosPixel(m_aSplitter.LogicToPixel(Size(0,nSplitPos)).Height()); + m_aSplitter->SetSplitPosPixel(m_aSplitter->LogicToPixel(Size(0,nSplitPos)).Height()); return 0L; } @@ -371,21 +382,21 @@ void OSectionWindow::scrollChildren(long _nX) { const Point aDelta( _nX,0 ); - MapMode aMapMode( m_aReportSection.GetMapMode() ); + MapMode aMapMode( m_aReportSection->GetMapMode() ); const Point aOld = aMapMode.GetOrigin(); - lcl_setOrigin(m_aReportSection,aDelta.X(), 0); + lcl_setOrigin(*m_aReportSection.get(), aDelta.X(), 0); - aMapMode = m_aReportSection.GetMapMode(); + aMapMode = m_aReportSection->GetMapMode(); const Point aNew = aMapMode.GetOrigin(); const Point aDiff = aOld - aNew; { - lcl_scroll(m_aReportSection,aDiff); + lcl_scroll(*m_aReportSection.get(), aDiff); } - lcl_scroll(m_aEndMarker,m_aEndMarker.PixelToLogic(Point(_nX,0))); + lcl_scroll(*m_aEndMarker.get(), m_aEndMarker->PixelToLogic(Point(_nX,0))); - lcl_setOrigin(m_aSplitter,_nX, 0); - lcl_scroll(m_aSplitter,aDiff); + lcl_setOrigin(*m_aSplitter.get(),_nX, 0); + lcl_scroll(*m_aSplitter.get(),aDiff); } } // rptui diff --git a/reportdesign/source/ui/report/StartMarker.cxx b/reportdesign/source/ui/report/StartMarker.cxx index 37a1e7ce4608..a435b02a38ed 100644 --- a/reportdesign/source/ui/report/StartMarker.cxx +++ b/reportdesign/source/ui/report/StartMarker.cxx @@ -48,9 +48,9 @@ oslInterlockedCount OStartMarker::s_nImageRefCount = 0; OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry) : OColorListener(_pParent,_sColorEntry) -,m_aVRuler(this,WB_VERT) -,m_aText(this,WB_HYPHENATION) -,m_aImage(this,WB_LEFT|WB_TOP|WB_SCALE) +,m_aVRuler(VclPtr<Ruler>::Create(this,WB_VERT)) +,m_aText(VclPtr<FixedText>::Create(this,WB_HYPHENATION)) +,m_aImage(VclPtr<FixedImage>::Create(this,WB_LEFT|WB_TOP|WB_SCALE)) ,m_pParent(_pParent) ,m_bShowRuler(true) { @@ -59,20 +59,20 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry osl_atomic_increment(&s_nImageRefCount); initDefaultNodeImages(); ImplInitSettings(); - m_aText.SetHelpId(HID_RPT_START_TITLE); - m_aText.SetPaintTransparent(true); - m_aImage.SetHelpId(HID_RPT_START_IMAGE); - m_aText.Show(); - m_aImage.Show(); - m_aVRuler.Show(); - m_aVRuler.Activate(); - m_aVRuler.SetPagePos(0); - m_aVRuler.SetBorders(); - m_aVRuler.SetIndents(); - m_aVRuler.SetMargin1(); - m_aVRuler.SetMargin2(); + m_aText->SetHelpId(HID_RPT_START_TITLE); + m_aText->SetPaintTransparent(true); + m_aImage->SetHelpId(HID_RPT_START_IMAGE); + m_aText->Show(); + m_aImage->Show(); + m_aVRuler->Show(); + m_aVRuler->Activate(); + m_aVRuler->SetPagePos(0); + m_aVRuler->SetBorders(); + m_aVRuler->SetIndents(); + m_aVRuler->SetMargin1(); + m_aVRuler->SetMargin2(); const MeasurementSystem eSystem = SvtSysLocale().GetLocaleData().getMeasurementSystemEnum(); - m_aVRuler.SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); + m_aVRuler->SetUnit(MEASURE_METRIC == eSystem ? FUNIT_CM : FUNIT_INCH); EnableChildTransparentMode( true ); SetParentClipMode( PARENTCLIPMODE_NOCLIP ); SetPaintTransparent( true ); @@ -80,18 +80,28 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry OStartMarker::~OStartMarker() { + disposeOnce(); +} + +void OStartMarker::dispose() +{ if ( osl_atomic_decrement(&s_nImageRefCount) == 0 ) { DELETEZ(s_pDefCollapsed); DELETEZ(s_pDefExpanded); } + m_aVRuler.disposeAndClear(); + m_aText.disposeAndClear(); + m_aImage.disposeAndClear(); + m_pParent.clear(); + OColorListener::dispose(); } sal_Int32 OStartMarker::getMinHeight() const { Fraction aExtraWidth(long(2*REPORT_EXTRA_SPACE)); aExtraWidth *= GetMapMode().GetScaleX(); - return LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() + (long)aExtraWidth; + return LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() + (long)aExtraWidth; } void OStartMarker::Paint( const Rectangle& rRect ) @@ -107,7 +117,7 @@ void OStartMarker::Paint( const Rectangle& rRect ) } else { - const long nVRulerWidth = m_aVRuler.GetSizePixel().Width(); + const long nVRulerWidth = m_aVRuler->GetSizePixel().Width(); nSize = aSize.Width() - nVRulerWidth; aSize.Width() += nCornerWidth; SetClipRegion(vcl::Region(PixelToLogic(Rectangle(Point(),Size(nSize,aSize.Height()))))); @@ -148,8 +158,8 @@ void OStartMarker::setColor() Color aTextColor = GetTextColor(); if ( aColor.GetLuminance() < 128 ) aTextColor = COL_WHITE; - m_aText.SetTextColor(aTextColor); - m_aText.SetLineColor(m_nColor); + m_aText->SetTextColor(aTextColor); + m_aText->SetLineColor(m_nColor); } void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt ) @@ -162,14 +172,14 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt ) const Size aOutputSize = GetOutputSizePixel(); if( aPos.X() > aOutputSize.Width() || aPos.Y() > aOutputSize.Height() ) return; - Rectangle aRect(m_aImage.GetPosPixel(),m_aImage.GetSizePixel()); + Rectangle aRect(m_aImage->GetPosPixel(),m_aImage->GetSizePixel()); if ( rMEvt.GetClicks() == 2 || aRect.IsInside( aPos ) ) { m_bCollapsed = !m_bCollapsed; changeImage(); - m_aVRuler.Show(!m_bCollapsed && m_bShowRuler); + m_aVRuler->Show(!m_bCollapsed && m_bShowRuler); if ( m_aCollapsedLink.IsSet() ) m_aCollapsedLink.Call(this); } @@ -180,7 +190,7 @@ void OStartMarker::MouseButtonUp( const MouseEvent& rMEvt ) void OStartMarker::changeImage() { Image* pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded; - m_aImage.SetImage(*pImage); + m_aImage->SetImage(*pImage); } void OStartMarker::initDefaultNodeImages() @@ -192,11 +202,11 @@ void OStartMarker::initDefaultNodeImages() } Image* pImage = m_bCollapsed ? s_pDefCollapsed : s_pDefExpanded; - m_aImage.SetImage(*pImage); - m_aImage.SetMouseTransparent(true); - m_aImage.SetBackground(); - m_aText.SetBackground(); - m_aText.SetMouseTransparent(true); + m_aImage->SetImage(*pImage); + m_aImage->SetMouseTransparent(true); + m_aImage->SetBackground(); + m_aText->SetBackground(); + m_aText->SetMouseTransparent(true); } void OStartMarker::ImplInitSettings() @@ -212,11 +222,11 @@ void OStartMarker::Resize() const long nOutputWidth = aOutputSize.Width(); const long nOutputHeight = aOutputSize.Height(); - const long nVRulerWidth = m_aVRuler.GetSizePixel().Width(); + const long nVRulerWidth = m_aVRuler->GetSizePixel().Width(); const Point aRulerPos(nOutputWidth - nVRulerWidth,0); - m_aVRuler.SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight)); + m_aVRuler->SetPosSizePixel(aRulerPos,Size(nVRulerWidth,nOutputHeight)); - Size aImageSize = m_aImage.GetImage().GetSizePixel(); + Size aImageSize = m_aImage->GetImage().GetSizePixel(); const MapMode& rMapMode = GetMapMode(); aImageSize.Width() = long(aImageSize.Width() * (double)rMapMode.GetScaleX()); aImageSize.Height() = long(aImageSize.Height() * (double)rMapMode.GetScaleY()); @@ -225,17 +235,17 @@ void OStartMarker::Resize() aExtraWidth *= rMapMode.GetScaleX(); Point aPos(aImageSize.Width() + (long)(aExtraWidth + aExtraWidth), aExtraWidth); - const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText.GetTextHeight())).Height()); - m_aText.SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight)); + const long nHeight = ::std::max<sal_Int32>(nOutputHeight - 2*aPos.Y(),LogicToPixel(Size(0,m_aText->GetTextHeight())).Height()); + m_aText->SetPosSizePixel(aPos,Size(aRulerPos.X() - aPos.X(),nHeight)); aPos.X() = aExtraWidth; - aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText.GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ; - m_aImage.SetPosSizePixel(aPos,aImageSize); + aPos.Y() += static_cast<sal_Int32>((LogicToPixel(Size(0,m_aText->GetTextHeight())).Height() - aImageSize.Height()) * 0.5) ; + m_aImage->SetPosSizePixel(aPos,aImageSize); } void OStartMarker::setTitle(const OUString& _sTitle) { - m_aText.SetText(_sTitle); + m_aText->SetText(_sTitle); } void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint) @@ -252,12 +262,12 @@ void OStartMarker::Notify(SfxBroadcaster & rBc, SfxHint const & rHint) void OStartMarker::showRuler(bool _bShow) { m_bShowRuler = _bShow; - m_aVRuler.Show(!m_bCollapsed && m_bShowRuler); + m_aVRuler->Show(!m_bCollapsed && m_bShowRuler); } void OStartMarker::RequestHelp( const HelpEvent& rHEvt ) { - if( !m_aText.GetText().isEmpty()) + if( !m_aText->GetText().isEmpty()) { // Hilfe anzeigen Rectangle aItemRect(rHEvt.GetMousePosPixel(),Size(GetSizePixel().Width(),getMinHeight())); @@ -268,9 +278,9 @@ void OStartMarker::RequestHelp( const HelpEvent& rHEvt ) aItemRect.Right() = aPt.X(); aItemRect.Bottom() = aPt.Y(); if( rHEvt.GetMode() == HelpEventMode::BALLOON ) - Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText.GetText()); + Help::ShowBalloon( this, aItemRect.Center(), aItemRect, m_aText->GetText()); else - Help::ShowQuickHelp( this, aItemRect, m_aText.GetText() ); + Help::ShowQuickHelp( this, aItemRect, m_aText->GetText() ); } } @@ -284,8 +294,8 @@ void OStartMarker::setCollapsed(bool _bCollapsed) void OStartMarker::zoom(const Fraction& _aZoom) { setZoomFactor(_aZoom,*this); - m_aVRuler.SetZoom(_aZoom); - setZoomFactor(_aZoom,m_aText); + m_aVRuler->SetZoom(_aZoom); + setZoomFactor(_aZoom, *m_aText.get()); Resize(); Invalidate(); } diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 9a7afeeae66c..49bf68956faf 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -185,8 +185,15 @@ OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow) OViewsWindow::~OViewsWindow() { + disposeOnce(); +} + +void OViewsWindow::dispose() +{ m_aColorConfig.RemoveListener(this); m_aSections.clear(); + m_pParent.clear(); + vcl::Window::dispose(); } void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet) @@ -219,8 +226,8 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow) TSectionsMap::iterator aEnd = m_aSections.end(); for (;aIter != aEnd ; ++aIter) { - const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter); - if ( pSectionWindow.get() == &_rSectionWindow ) + OSectionWindow* pSectionWindow = (*aIter); + if ( pSectionWindow == &_rSectionWindow ) { aStartPoint = pSectionWindow->GetPosPixel(); bSet = true; @@ -228,7 +235,7 @@ void OViewsWindow::resize(const OSectionWindow& _rSectionWindow) if ( bSet ) { - impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,bSet); + impl_resizeSectionWindow(*pSectionWindow,aStartPoint,bSet); static sal_Int32 nIn = INVALIDATE_UPDATE | INVALIDATE_TRANSPARENT; pSectionWindow->getStartMarker().Invalidate( nIn ); // INVALIDATE_NOERASE |INVALIDATE_NOCHILDREN| INVALIDATE_TRANSPARENT pSectionWindow->getEndMarker().Invalidate( nIn ); @@ -248,8 +255,8 @@ void OViewsWindow::Resize() TSectionsMap::iterator aEnd = m_aSections.end(); for (;aIter != aEnd ; ++aIter) { - const ::boost::shared_ptr<OSectionWindow> pSectionWindow = (*aIter); - impl_resizeSectionWindow(*pSectionWindow.get(),aStartPoint,true); + OSectionWindow* pSectionWindow = (*aIter); + impl_resizeSectionWindow(*pSectionWindow,aStartPoint,true); } } } @@ -292,7 +299,7 @@ void OViewsWindow::DataChanged( const DataChangedEvent& rDCEvt ) void OViewsWindow::addSection(const uno::Reference< report::XSection >& _xSection,const OUString& _sColorEntry,sal_uInt16 _nPosition) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow( new OSectionWindow(this,_xSection,_sColorEntry) ); + VclPtrInstance<OSectionWindow> pSectionWindow(this,_xSection,_sColorEntry); m_aSections.insert(getIteratorAtPos(_nPosition) , TSectionsMap::value_type(pSectionWindow)); m_pParent->setMarked(&pSectionWindow->getReportSection().getSectionView(),m_aSections.size() == 1); Resize(); @@ -392,17 +399,17 @@ void OViewsWindow::Paste() ::o3tl::compose1(::boost::bind(&OReportSection::Paste,_1,aCopies,false),TReportPairHelper())); else { - ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection(); + OSectionWindow* pMarkedSection = getMarkedSection(); if ( pMarkedSection ) pMarkedSection->getReportSection().Paste(aCopies,true); } } -::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const +OSectionWindow* OViewsWindow::getSectionWindow(const uno::Reference< report::XSection>& _xSection) const { OSL_ENSURE(_xSection.is(),"Section is NULL!"); - ::boost::shared_ptr<OSectionWindow> pSectionWindow; + OSectionWindow* pSectionWindow = NULL; TSectionsMap::const_iterator aIter = m_aSections.begin(); TSectionsMap::const_iterator aEnd = m_aSections.end(); for (; aIter != aEnd ; ++aIter) @@ -418,9 +425,9 @@ void OViewsWindow::Paste() } -::boost::shared_ptr<OSectionWindow> OViewsWindow::getMarkedSection(NearSectionAccess nsa) const +OSectionWindow* OViewsWindow::getMarkedSection(NearSectionAccess nsa) const { - ::boost::shared_ptr<OSectionWindow> pRet; + OSectionWindow* pRet = NULL; TSectionsMap::const_iterator aIter = m_aSections.begin(); TSectionsMap::const_iterator aEnd = m_aSections.end(); sal_uInt32 nCurrentPosition = 0; @@ -624,7 +631,7 @@ void OViewsWindow::setMarked(const uno::Sequence< uno::Reference< report::XRepor bFirst = false; m_pParent->setMarked(xSection,_bMark); } - ::boost::shared_ptr<OSectionWindow> pSectionWindow = getSectionWindow(xSection); + OSectionWindow* pSectionWindow = getSectionWindow(xSection); if ( pSectionWindow ) { SvxShape* pShape = SvxShape::getImplementation( *pIter ); @@ -881,7 +888,7 @@ void OViewsWindow::alignMarkedObjects(sal_Int32 _nControlModification,bool _bAli void OViewsWindow::createDefault() { - ::boost::shared_ptr<OSectionWindow> pMarkedSection = getMarkedSection(); + OSectionWindow* pMarkedSection = getMarkedSection(); if ( pMarkedSection ) pMarkedSection->getReportSection().createDefault(m_sShapeType); } @@ -922,9 +929,9 @@ sal_uInt16 OViewsWindow::getPosition(const OSectionWindow* _pSectionWindow) cons return nPosition; } -::boost::shared_ptr<OSectionWindow> OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const +OSectionWindow* OViewsWindow::getSectionWindow(const sal_uInt16 _nPos) const { - ::boost::shared_ptr<OSectionWindow> aReturn; + OSectionWindow* aReturn = NULL; if ( _nPos < m_aSections.size() ) aReturn = m_aSections[_nPos]; diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 0e8f7b6492c1..0fb2b0e62dfe 100644 --- a/reportdesign/source/ui/report/propbrw.cxx +++ b/reportdesign/source/ui/report/propbrw.cxx @@ -185,6 +185,11 @@ PropBrw::PropBrw(const Reference< XComponentContext >& _xORB, vcl::Window* pPare PropBrw::~PropBrw() { + disposeOnce(); +} + +void PropBrw::dispose() +{ if (m_xBrowserController.is()) implDetachController(); @@ -204,6 +209,8 @@ PropBrw::~PropBrw() {} ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); + m_pDesignView.clear(); + DockingWindow::dispose(); } void PropBrw::setCurrentPage(const OUString& _sLastActivePage) @@ -507,7 +514,7 @@ void PropBrw::Update( OSectionView* pNewView ) const sal_uInt16 nSectionCount = pViews->getSectionCount(); for (sal_uInt16 i = 0; i < nSectionCount; ++i) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = pViews->getSectionWindow(i); + OSectionWindow* pSectionWindow = pViews->getSectionWindow(i); if ( pSectionWindow ) { const SdrMarkList& rMarkList = pSectionWindow->getReportSection().getSectionView().GetMarkedObjectList(); |