diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-26 13:14:14 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 21:38:43 +0100 |
commit | 074ef56bb08795bbf85082eab7907dc7f93d48b7 (patch) | |
tree | 66ec50b94b2b3d4747809a79860a7fc28884edee /reportdesign | |
parent | a3cc3ce5a412112500606827fc99275e28898fff (diff) |
vcl: VclPtr conversion in reportdesign
Change-Id: Iadbd90bfe2cdf6afff3d745ac488036c3d031963
Diffstat (limited to 'reportdesign')
25 files changed, 506 insertions, 373 deletions
diff --git a/reportdesign/source/ui/dlg/AddField.cxx b/reportdesign/source/ui/dlg/AddField.cxx index d1e646097710..325fdb8a49e1 100644 --- a/reportdesign/source/ui/dlg/AddField.cxx +++ b/reportdesign/source/ui/dlg/AddField.cxx @@ -151,11 +151,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_aActions(new ToolBox(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_aFixedLine(new FixedLine(this, ModuleRes(ADDFIELD_FL_HELP_SEPARATOR) )) + ,m_aHelpText(new FixedText(this, ModuleRes(ADDFIELD_HELP_FIELD) )) + ,m_aInsertButton(new PushButton(this, WB_TABSTOP|WB_CENTER)) ,m_nCommandType(0) ,m_bEscapeProcessing(false) ,m_pChangeListener(NULL) @@ -165,13 +165,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 +179,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 +209,11 @@ OAddFieldWindow::OAddFieldWindow(vcl::Window* pParent OAddFieldWindow::~OAddFieldWindow() { + dispose(); +} + +void OAddFieldWindow::dispose() +{ if ( m_pListBox.get() ) { SvTreeList* pModel = m_pListBox->GetModel(); @@ -222,6 +227,12 @@ OAddFieldWindow::~OAddFieldWindow() m_pChangeListener->dispose(); if ( m_pContainerListener.is() ) m_pContainerListener->dispose(); + + m_aActions.disposeAndClear(); + m_aFixedLine.disposeAndClear(); + m_aHelpText.disposeAndClear(); + m_aInsertButton.disposeAndClear(); + FloatingWindow::dispose(); } @@ -307,10 +318,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 +367,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 +391,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 +413,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 +488,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 +506,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 +520,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/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx index 26e5989dce07..c5e131a23314 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; + 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( new ValueSet(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,45 @@ 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() +{ + dispose(); +} + +void OColorPopup::dispose() +{ + m_aColorSet.disposeAndClear(); + FloatingWindow::dispose(); } void OColorPopup::KeyInput( const KeyEvent& rKEvt ) { - m_aColorSet.KeyInput(rKEvt); + m_aColorSet->KeyInput(rKEvt); } void OColorPopup::Resize() @@ -162,12 +175,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 +188,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,6 +307,11 @@ sal_uInt16 Condition::mapToolbarItemToSlotId(sal_uInt16 nItemId) const Condition::~Condition() { + dispose(); +} + +void Condition::dispose() +{ m_bInDestruction = true; delete m_pColorFloat; @@ -301,6 +319,7 @@ Condition::~Condition() delete m_pCondLHS; delete m_pCondRHS; delete m_pBtnUpdaterBackgroundColor; + VclHBox::dispose(); } IMPL_LINK( Condition, DropdownClick, ToolBox*, /*pToolBar*/ ) diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx index 14fa15fba7cc..7ad63a6518df 100644 --- a/reportdesign/source/ui/dlg/Condition.hxx +++ b/reportdesign/source/ui/dlg/Condition.hxx @@ -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/Formula.cxx b/reportdesign/source/ui/dlg/Formula.cxx index 4d7746303d45..b1bac300709c 100644 --- a/reportdesign/source/ui/dlg/Formula.cxx +++ b/reportdesign/source/ui/dlg/Formula.cxx @@ -87,6 +87,11 @@ void FormulaDialog::fill() FormulaDialog::~FormulaDialog() { + dispose(); +} + +void FormulaDialog::dispose() +{ if ( m_pAddField ) { SvtViewOptions aDlgOpt( E_WINDOW, OUString( HID_RPT_FIELD_SEL_WIN ) ); @@ -97,6 +102,7 @@ FormulaDialog::~FormulaDialog() } StoreFormEditData( m_pFormulaData ); + formula::FormulaModalDialog::dispose(); } diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index b6e687dc7c55..0aadd00d0678 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -97,6 +97,7 @@ class OFieldExpressionControl : public TContainerListenerBase 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; @@ -182,6 +183,12 @@ OFieldExpressionControl::OFieldExpressionControl(OGroupsSortingDialog* _pParentD OFieldExpressionControl::~OFieldExpressionControl() { + dispose(); +} + + +void OFieldExpressionControl::dispose() +{ WeakImplHelper1::acquire(); uno::Reference< report::XGroups > xGroups = m_pParent->getGroups(); xGroups->removeContainerListener(this); @@ -193,6 +200,7 @@ OFieldExpressionControl::~OFieldExpressionControl() Application::RemoveUserEvent( m_nDeleteEvent ); delete m_pComboCell; + OFieldExpressionControl_Base::dispose(); } uno::Sequence<uno::Any> OFieldExpressionControl::fillSelectedGroups() @@ -970,11 +978,17 @@ OGroupsSortingDialog::OGroupsSortingDialog(vcl::Window* _pParent, bool _bReadOnl OGroupsSortingDialog::~OGroupsSortingDialog() { + dispose(); +} + +void OGroupsSortingDialog::dispose() +{ delete m_pFieldExpression; m_xColumns.clear(); m_pReportListener->dispose(); if ( m_pCurrentGroupListener.is() ) m_pCurrentGroupListener->dispose(); + FloatingWindow::dispose(); } void OGroupsSortingDialog::UpdateData( ) diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index d36b7615b6f6..51c995bce1fc 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -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() { + dispose(); +} + +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 ) diff --git a/reportdesign/source/ui/inc/AddField.hxx b/reportdesign/source/ui/inc/AddField.hxx index fba3c7abf59c..76dabea0ed24 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<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/DesignView.hxx b/reportdesign/source/ui/inc/DesignView.hxx index 0faeb693bd84..e2c4770e1b87 100644 --- a/reportdesign/source/ui/inc/DesignView.hxx +++ b/reportdesign/source/ui/inc/DesignView.hxx @@ -59,12 +59,12 @@ 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; + VclPtr<OScrollWindowHelper> m_aScrollWindow; + vcl::Window* m_pTaskPane; PropBrw* m_pPropWin; OAddFieldWindow* m_pAddField; OSectionView* m_pCurrentView; @@ -72,8 +72,8 @@ namespace rptui 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; diff --git a/reportdesign/source/ui/inc/Formula.hxx b/reportdesign/source/ui/inc/Formula.hxx index f6d686747f1e..c077aad6cf16 100644 --- a/reportdesign/source/ui/inc/Formula.hxx +++ b/reportdesign/source/ui/inc/Formula.hxx @@ -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..32f01d0c82e1 100644 --- a/reportdesign/source/ui/inc/GroupsSorting.hxx +++ b/reportdesign/source/ui/inc/GroupsSorting.hxx @@ -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/ReportSection.hxx b/reportdesign/source/ui/inc/ReportSection.hxx index bef2ae1e2ea4..6add8b3fa617 100644 --- a/reportdesign/source/ui/inc/ReportSection.hxx +++ b/reportdesign/source/ui/inc/ReportSection.hxx @@ -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..5c4e9b6e41d3 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; + VclPtr<Ruler> m_aHRuler; ODesignView* m_pView; OScrollWindowHelper* m_pParent; - OViewsWindow m_aViewsWindow; + 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 */ diff --git a/reportdesign/source/ui/inc/ScrollHelper.hxx b/reportdesign/source/ui/inc/ScrollHelper.hxx index ec5cc90d2439..6f8152d7bb64 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; + 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 ); diff --git a/reportdesign/source/ui/inc/SectionWindow.hxx b/reportdesign/source/ui/inc/SectionWindow.hxx index 79e184cb9d0b..d8680fbcc1ff 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; + 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..5688b96d8059 100644 --- a/reportdesign/source/ui/inc/StartMarker.hxx +++ b/reportdesign/source/ui/inc/StartMarker.hxx @@ -31,9 +31,9 @@ namespace rptui class OStartMarker : public OColorListener { - Ruler m_aVRuler; - FixedText m_aText; - FixedImage m_aImage; + VclPtr<Ruler> m_aVRuler; + VclPtr<FixedText> m_aText; + VclPtr<FixedImage> m_aImage; OSectionWindow* m_pParent; static Image* s_pDefCollapsed; static Image* s_pDefExpanded; @@ -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..ec842fd7020e 100644 --- a/reportdesign/source/ui/inc/ViewsWindow.hxx +++ b/reportdesign/source/ui/inc/ViewsWindow.hxx @@ -153,6 +153,7 @@ namespace rptui OViewsWindow( OReportWindow* _pReportWindow); virtual ~OViewsWindow(); + virtual void dispose() SAL_OVERRIDE; // Window overrides virtual void Resize() SAL_OVERRIDE; diff --git a/reportdesign/source/ui/inc/propbrw.hxx b/reportdesign/source/ui/inc/propbrw.hxx index 43ec71c790b2..4dcdc2bb4987 100644 --- a/reportdesign/source/ui/inc/propbrw.hxx +++ b/reportdesign/source/ui/inc/propbrw.hxx @@ -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/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index 96953d86019a..ed975eb8fc28 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -84,9 +84,9 @@ ODesignView::ODesignView( vcl::Window* pParent, const Reference< XComponentContext >& _rxOrb, OReportController& _rController) : ODataView( pParent, _rController, _rxOrb, WB_DIALOGCONTROL ) - ,m_aSplitWin(this) + ,m_aSplitWin(new SplitWindow(this)) ,m_rReportController( _rController ) - ,m_aScrollWindow(this) + ,m_aScrollWindow(new rptui::OScrollWindowHelper(this)) ,m_pPropWin(NULL) ,m_pAddField(NULL) ,m_pCurrentView(NULL) @@ -109,14 +109,14 @@ ODesignView::ODesignView( vcl::Window* pParent, // now create the task pane on the right side :-) m_pTaskPane = new OTaskWindow(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,9 +125,14 @@ ODesignView::ODesignView( vcl::Window* pParent, ODesignView::~ODesignView() { + dispose(); +} + +void ODesignView::dispose() +{ m_bDeleted = true; Hide(); - m_aScrollWindow.Hide(); + m_aScrollWindow->Hide(); m_aMarkIdle.Stop(); if ( m_pPropWin ) { @@ -155,13 +160,17 @@ ODesignView::~ODesignView() ::std::unique_ptr<vcl::Window> aTemp2(m_pTaskPane); m_pTaskPane = NULL; } + + m_aSplitWin.disposeAndClear(); + m_aScrollWindow.disposeAndClear(); + 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 ) @@ -231,7 +240,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 +257,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() ); @@ -288,18 +297,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 +324,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 +356,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 +370,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 +399,7 @@ void ODesignView::GetFocus() if ( !m_bDeleted ) { - ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow.getMarkedSection(); + ::boost::shared_ptr<OSectionWindow> pSectionWindow = m_aScrollWindow->getMarkedSection(); if ( pSectionWindow ) pSectionWindow->GrabFocus(); } @@ -406,12 +415,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,12 +432,12 @@ 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) @@ -451,9 +460,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 +475,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(); } @@ -553,27 +562,27 @@ uno::Reference< report::XReportComponent > ODesignView::getCurrentControlModel() ::boost::shared_ptr<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 { - 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 +598,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 +609,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 +623,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 @@ -655,18 +664,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 +685,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/ReportSection.cxx b/reportdesign/source/ui/report/ReportSection.cxx index 1a70619ecc33..fffd3c9d884b 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() { + dispose(); +} + +void OReportSection::dispose() +{ m_pPage = NULL; if ( m_pMulti.is() ) m_pMulti->dispose(); @@ -125,6 +130,7 @@ OReportSection::~OReportSection() m_pView->EndListening( *m_pModel ); m_pView = NULL; } + 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..42c346840c44 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(new Ruler(this)) ,m_pView(_pView) ,m_pParent(_pParent) -,m_aViewsWindow(this) +,m_aViewsWindow(new rptui::OViewsWindow(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,38 @@ OReportWindow::OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView) OReportWindow::~OReportWindow() { + dispose(); +} + +void OReportWindow::dispose() +{ if ( m_pReportListener.is() ) m_pReportListener->dispose(); + m_aHRuler.disposeAndClear(); + m_aViewsWindow.disposeAndClear(); + 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 +124,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 +153,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 +170,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 +181,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 +228,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 +257,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 ); + ::boost::shared_ptr<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 { - 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 { - 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 +392,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 +418,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 +436,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..d43068c02dca 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( new ScrollBar(this, WB_HSCROLL|WB_REPEAT|WB_DRAG) ) + ,m_aVScroll( new ScrollBar(this, WB_VSCROLL|WB_REPEAT|WB_DRAG) ) + ,m_aCornerWin( new ScrollBarBox(this) ) ,m_pParent(_pDesignView) - ,m_aReportWindow(this,m_pParent) + ,m_aReportWindow(new rptui::OReportWindow(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,19 @@ OScrollWindowHelper::OScrollWindowHelper( ODesignView* _pDesignView) OScrollWindowHelper::~OScrollWindowHelper() { + dispose(); +} + +void OScrollWindowHelper::dispose() +{ if ( m_pReportDefintionMultiPlexer.is() ) m_pReportDefintionMultiPlexer->dispose(); + + m_aHScroll.disposeAndClear(); + m_aVScroll.disposeAndClear(); + m_aCornerWin.disposeAndClear(); + m_aReportWindow.disposeAndClear(); + OScrollWindowHelper_BASE::dispose(); } @@ -101,8 +112,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 +125,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 +154,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 +189,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 +202,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 { - 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 { - 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 +335,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 +349,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 +374,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..65827a1ac75a 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( new rptui::OStartMarker(this,_sColorEntry)) +,m_aReportSection( new rptui::OReportSection(this,_xSection)) +,m_aSplitter(new Splitter(this)) +,m_aEndMarker( new rptui::OEndMarker(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() { + dispose(); +} + +void OSectionWindow::dispose() +{ try { if ( m_pSectionMulti.is() ) @@ -110,6 +115,11 @@ OSectionWindow::~OSectionWindow() catch (uno::Exception&) { } + m_aStartMarker.disposeAndClear(); + m_aReportSection.disposeAndClear(); + m_aSplitter.disposeAndClear(); + m_aEndMarker.disposeAndClear(); + vcl::Window::dispose(); } void OSectionWindow::_propertyChanged(const beans::PropertyChangeEvent& _rEvent) @@ -119,7 +129,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 +147,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 +170,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 +183,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 +195,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 +235,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 +250,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 +300,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 +312,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 +342,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 +359,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 +381,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..23caea3a2cde 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(new Ruler(this,WB_VERT)) +,m_aText(new FixedText(this,WB_HYPHENATION)) +,m_aImage(new FixedImage(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,27 @@ OStartMarker::OStartMarker(OSectionWindow* _pParent,const OUString& _sColorEntry OStartMarker::~OStartMarker() { + dispose(); +} + +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(); + 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 +116,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 +157,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 +171,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 +189,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 +201,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 +221,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 +234,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 +261,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 +277,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 +293,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 30d690c799da..803be1cd0519 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -185,8 +185,14 @@ OViewsWindow::OViewsWindow( OReportWindow* _pReportWindow) OViewsWindow::~OViewsWindow() { + dispose(); +} + +void OViewsWindow::dispose() +{ m_aColorConfig.RemoveListener(this); m_aSections.clear(); + vcl::Window::dispose(); } void OViewsWindow::impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet) diff --git a/reportdesign/source/ui/report/propbrw.cxx b/reportdesign/source/ui/report/propbrw.cxx index 0e8f7b6492c1..a7d195c81849 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() { + dispose(); +} + +void PropBrw::dispose() +{ if (m_xBrowserController.is()) implDetachController(); @@ -204,6 +209,7 @@ PropBrw::~PropBrw() {} ::rptui::notifySystemWindow(this,this,::comphelper::mem_fun(&TaskPaneList::RemoveWindow)); + DockingWindow::dispose(); } void PropBrw::setCurrentPage(const OUString& _sLastActivePage) |