diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-12 15:16:05 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2015-04-09 20:33:46 +0100 |
commit | ce8cfbd3b90f11c3f2edc88a0dab625aabb6293d (patch) | |
tree | 7128c82bf9c71332342de974fd1f0ab32ee0bc72 | |
parent | 1f59e2cec3f4a22d612ca6cff06930c3d4bb77ca (diff) |
svtools: apply vcl::window refcounting changes
Change-Id: I308f045eaf5c50de26175a2f00f8b0791cdd8ab9
Conflicts:
svtools/source/control/tabbar.cxx
86 files changed, 771 insertions, 492 deletions
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index f2303725b71c..a9460132562a 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -55,6 +55,7 @@ private: DECL_LINK( AppEventListenerHdl, VclWindowEvent * ); virtual ~SplashScreen(); + virtual void dispose() SAL_OVERRIDE; void loadConfig(); void updateStatus(); void SetScreenBitmap(BitmapEx &rBitmap); @@ -154,10 +155,15 @@ SplashScreen::SplashScreen() SplashScreen::~SplashScreen() { + dispose(); +} + +void SplashScreen::dispose() +{ Application::RemoveEventListener( LINK( this, SplashScreen, AppEventListenerHdl ) ); Hide(); - + IntroWindow::dispose(); } void SAL_CALL SplashScreen::start(const OUString&, sal_Int32 nRange) diff --git a/include/svtools/DocumentInfoPreview.hxx b/include/svtools/DocumentInfoPreview.hxx index e75877588029..9eba310af05c 100644 --- a/include/svtools/DocumentInfoPreview.hxx +++ b/include/svtools/DocumentInfoPreview.hxx @@ -43,6 +43,7 @@ public: ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits); virtual ~ODocumentInfoPreview(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; @@ -54,8 +55,8 @@ public: OUString const & rURL); private: - ExtMultiLineEdit m_pEditWin; - std::unique_ptr< SvtDocInfoTable_Impl > m_xInfoTable; + VclPtr<ExtMultiLineEdit> m_pEditWin; + boost::scoped_ptr< SvtDocInfoTable_Impl > m_xInfoTable; LanguageTag m_aLanguageTag; void insertEntry(OUString const & title, OUString const & value); diff --git a/include/svtools/GraphicExportOptionsDialog.hxx b/include/svtools/GraphicExportOptionsDialog.hxx index 1982aa1bc679..5c8e7ed0c76c 100644 --- a/include/svtools/GraphicExportOptionsDialog.hxx +++ b/include/svtools/GraphicExportOptionsDialog.hxx @@ -62,7 +62,6 @@ private: public: GraphicExportOptionsDialog( vcl::Window* pWindow, const css::uno::Reference<css::lang::XComponent>& rxSourceDocument ); - virtual ~GraphicExportOptionsDialog(); css::uno::Sequence<css::beans::PropertyValue> getFilterData(); }; diff --git a/include/svtools/PlaceEditDialog.hxx b/include/svtools/PlaceEditDialog.hxx index 5cdad02f1807..de8c9562dd80 100644 --- a/include/svtools/PlaceEditDialog.hxx +++ b/include/svtools/PlaceEditDialog.hxx @@ -27,7 +27,6 @@ class SVT_DLLPUBLIC PlaceEditDialog : public ModalDialog { private : - Edit* m_pEDServerName; ListBox* m_pLBServerType; std::shared_ptr< DetailsContainer > m_xCurrentDetails; @@ -55,7 +54,7 @@ public : // Returns a place instance with given information std::shared_ptr<Place> GetPlace(); - OUString GetServerName() { return m_pEDServerName->GetText(); } + OUString GetServerName() { return m_pEDServerName->GetText(); } OUString GetServerUrl(); private: diff --git a/include/svtools/addresstemplate.hxx b/include/svtools/addresstemplate.hxx index d771efb5e473..dec91a887b1d 100644 --- a/include/svtools/addresstemplate.hxx +++ b/include/svtools/addresstemplate.hxx @@ -100,6 +100,7 @@ namespace svt ); virtual ~AddressBookSourceDialog(); + virtual void dispose() SAL_OVERRIDE; // to be used if the object was constructed for editing a field mapping only void getFieldMapping( diff --git a/include/svtools/brwbox.hxx b/include/svtools/brwbox.hxx index 9248d6134667..779815cf2e8a 100644 --- a/include/svtools/brwbox.hxx +++ b/include/svtools/brwbox.hxx @@ -22,6 +22,7 @@ #include <svtools/svtdllapi.h> #include <vcl/scrbar.hxx> #include <vcl/ctrl.hxx> +#include <vcl/vclptr.hxx> #include <tools/multisel.hxx> #include <svtools/headbar.hxx> #include <svtools/transfer.hxx> @@ -218,9 +219,9 @@ public: static const sal_uInt16 HandleColumnId = 0; private: - vcl::Window* pDataWin; // window to display data rows - ScrollBar* pVScroll; // vertical scrollbar - ScrollBar aHScroll; // horizontal scrollbar + vcl::Window* pDataWin; // window to display data rows + ScrollBar* pVScroll; // vertical scrollbar + VclPtr<ScrollBar> aHScroll; // horizontal scrollbar long nDataRowHeight; // height of a single data-row sal_uInt16 nTitleLines; // number of lines in title row @@ -425,7 +426,8 @@ public: BrowserMode nMode = 0 ); BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode = 0 ); - virtual ~BrowseBox(); + virtual ~BrowseBox(); + virtual void dispose() SAL_OVERRIDE; // override inherited handler virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/include/svtools/calendar.hxx b/include/svtools/calendar.hxx index e970842480a7..7948150cce1b 100644 --- a/include/svtools/calendar.hxx +++ b/include/svtools/calendar.hxx @@ -258,7 +258,8 @@ protected: public: Calendar( vcl::Window* pParent, WinBits nWinStyle = 0 ); - virtual ~Calendar(); + virtual ~Calendar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -416,7 +417,8 @@ private: public: CalendarField( vcl::Window* pParent, WinBits nWinStyle ); - virtual ~CalendarField(); + virtual ~CalendarField(); + virtual void dispose() SAL_OVERRIDE; void Select(); diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index d382a9d6e34b..b115065c04a6 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -159,6 +159,7 @@ public: WinBits nWinStyle = WB_BORDER ); ColorListBox( vcl::Window* pParent, const ResId& rResId ); virtual ~ColorListBox(); + virtual void dispose() SAL_OVERRIDE; virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE; @@ -303,6 +304,7 @@ public: LineListBox( vcl::Window* pParent, WinBits nWinStyle = WB_BORDER ); virtual ~LineListBox(); + virtual void dispose() SAL_OVERRIDE; /** Set the width in Twips */ void SetWidth( long nWidth ); @@ -400,6 +402,7 @@ public: FontNameBox( vcl::Window* pParent, WinBits nWinStyle = WB_SORT ); virtual ~FontNameBox(); + virtual void dispose() SAL_OVERRIDE; virtual void UserDraw( const UserDrawEvent& rUDEvt ) SAL_OVERRIDE; @@ -425,7 +428,6 @@ private: using ComboBox::SetText; public: FontStyleBox( vcl::Window* pParent, WinBits nBits ); - virtual ~FontStyleBox(); virtual void Select() SAL_OVERRIDE; virtual void LoseFocus() SAL_OVERRIDE; @@ -469,7 +471,6 @@ protected: public: FontSizeBox( vcl::Window* pParent, WinBits nWinStyle = 0 ); - virtual ~FontSizeBox(); void Reformat() SAL_OVERRIDE; void Modify() SAL_OVERRIDE; diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 30789c325c56..eedf170d9a8a 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -281,6 +281,7 @@ namespace svt public: CheckBoxControl(vcl::Window* pParent, WinBits nWinStyle = 0); virtual ~CheckBoxControl(); + virtual void dispose() SAL_OVERRIDE; virtual void GetFocus() SAL_OVERRIDE; virtual bool PreNotify(NotifyEvent& rEvt) SAL_OVERRIDE; @@ -593,6 +594,7 @@ namespace svt EditBrowseBox(vcl::Window* pParent, sal_Int32 nBrowserFlags = EBBF_NONE, WinBits nBits = WB_TABSTOP, BrowserMode nMode = 0 ); EditBrowseBox(vcl::Window* pParent, const ResId& rId, sal_Int32 nBrowserFlags = EBBF_NONE, BrowserMode nMode = 0 ); virtual ~EditBrowseBox(); + virtual void dispose() SAL_OVERRIDE; bool IsEditing() const {return aController.Is();} void InvalidateStatusCell(long nRow) {RowModified(nRow, 0);} diff --git a/include/svtools/editsyntaxhighlighter.hxx b/include/svtools/editsyntaxhighlighter.hxx index 5099750026b2..be6da6e118e2 100644 --- a/include/svtools/editsyntaxhighlighter.hxx +++ b/include/svtools/editsyntaxhighlighter.hxx @@ -40,7 +40,6 @@ class SVT_DLLPUBLIC MultiLineEditSyntaxHighlight : public MultiLineEdit public: MultiLineEditSyntaxHighlight( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER , HighlighterLanguage aLanguage = HIGHLIGHT_SQL); - virtual ~MultiLineEditSyntaxHighlight(); virtual void UpdateData() SAL_OVERRIDE; virtual void SetText(const OUString& rNewText) SAL_OVERRIDE; diff --git a/include/svtools/filectrl.hxx b/include/svtools/filectrl.hxx index 04e6e0a2819c..09e5fe671082 100644 --- a/include/svtools/filectrl.hxx +++ b/include/svtools/filectrl.hxx @@ -42,8 +42,8 @@ typedef sal_uInt16 FileControlMode_Internal; class SVT_DLLPUBLIC FileControl : public vcl::Window { private: - Edit maEdit; - PushButton maButton; + VclPtr<Edit> maEdit; + VclPtr<PushButton> maButton; OUString maButtonText; bool mbOpenDlg; @@ -65,10 +65,11 @@ protected: public: FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode = 0 ); - virtual ~FileControl(); + virtual ~FileControl(); + virtual void dispose() SAL_OVERRIDE; - Edit& GetEdit() { return maEdit; } - PushButton& GetButton() { return maButton; } + Edit& GetEdit() { return *maEdit.get(); } + PushButton& GetButton() { return *maButton.get(); } void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE; @@ -77,13 +78,13 @@ public: void SetText( const OUString& rStr ) SAL_OVERRIDE; OUString GetText() const SAL_OVERRIDE; - OUString GetSelectedText() const { return maEdit.GetSelected(); } + OUString GetSelectedText() const { return maEdit->GetSelected(); } - void SetSelection( const Selection& rSelection ) { maEdit.SetSelection( rSelection ); } - Selection GetSelection() const { return maEdit.GetSelection(); } + void SetSelection( const Selection& rSelection ) { maEdit->SetSelection( rSelection ); } + Selection GetSelection() const { return maEdit->GetSelection(); } - void SetReadOnly( bool bReadOnly = true ) { maEdit.SetReadOnly( bReadOnly ); } - bool IsReadOnly() const { return maEdit.IsReadOnly(); } + void SetReadOnly( bool bReadOnly = true ) { maEdit->SetReadOnly( bReadOnly ); } + bool IsReadOnly() const { return maEdit->IsReadOnly(); } //use this to manipulate the dialog bevore executing it: diff --git a/include/svtools/fileview.hxx b/include/svtools/fileview.hxx index b123f14a5c41..6b0dc15e61b3 100644 --- a/include/svtools/fileview.hxx +++ b/include/svtools/fileview.hxx @@ -82,6 +82,7 @@ protected: public: SvtFileView( vcl::Window* pParent, WinBits nBits, bool bOnlyFolder, bool bMultiSelection ); virtual ~SvtFileView(); + virtual void dispose() SAL_OVERRIDE; virtual Size GetOptimalSize() const SAL_OVERRIDE; diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx index bda86e2f4447..317ed6ec1756 100644 --- a/include/svtools/fmtfield.hxx +++ b/include/svtools/fmtfield.hxx @@ -91,7 +91,6 @@ protected: public: FormattedField(vcl::Window* pParent, WinBits nStyle = 0, SvNumberFormatter* pInitialFormatter = NULL, sal_Int32 nFormatKey = 0); - virtual ~FormattedField(); // Min-/Max-management bool HasMinValue() const { return m_bHasMin; } @@ -266,6 +265,7 @@ public: } virtual ~DoubleNumericField(); + virtual void dispose() SAL_OVERRIDE; protected: virtual bool CheckText(const OUString& sText) const SAL_OVERRIDE; diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx index fbd275a7de5a..0c6583ec80a1 100644 --- a/include/svtools/headbar.hxx +++ b/include/svtools/headbar.hxx @@ -285,6 +285,7 @@ private: public: HeaderBar( vcl::Window* pParent, WinBits nWinBits = WB_STDHEADERBAR ); virtual ~HeaderBar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/hyperlabel.hxx b/include/svtools/hyperlabel.hxx index eacfe4896372..cdda74067bab 100644 --- a/include/svtools/hyperlabel.hxx +++ b/include/svtools/hyperlabel.hxx @@ -32,7 +32,7 @@ namespace svt { - class HyperLabelImpl; + class HyperLabelImpl; class HyperLabel : public FixedText { @@ -54,6 +54,7 @@ namespace svt public: HyperLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 ); virtual ~HyperLabel( ); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index 7d2d4f5ccbee..35a0893ec09f 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -63,6 +63,7 @@ public: SvtURLBox( vcl::Window* pParent, WinBits _nStyle, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true ); SvtURLBox( vcl::Window* pParent, const ResId& _rResId, INetProtocol eSmart = INetProtocol::NotValid, bool bSetDefaultHelpID = true ); virtual ~SvtURLBox(); + virtual void dispose() SAL_OVERRIDE; void SetBaseURL( const OUString& rURL ); const OUString& GetBaseURL() const { return aBaseURL; } diff --git a/include/svtools/ivctrl.hxx b/include/svtools/ivctrl.hxx index db64201768b5..d1721fd3f927 100644 --- a/include/svtools/ivctrl.hxx +++ b/include/svtools/ivctrl.hxx @@ -259,6 +259,7 @@ public: SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle = WB_ICON | WB_BORDER ); virtual ~SvtIconChoiceCtrl(); + virtual void dispose() SAL_OVERRIDE; void SetStyle( WinBits nWinStyle ); WinBits GetStyle() const; diff --git a/include/svtools/prnsetup.hxx b/include/svtools/prnsetup.hxx index b7ed0fd8f3dc..6b87e5d7d5c2 100644 --- a/include/svtools/prnsetup.hxx +++ b/include/svtools/prnsetup.hxx @@ -60,7 +60,8 @@ private: public: PrinterSetupDialog( vcl::Window* pWindow ); - virtual ~PrinterSetupDialog(); + virtual ~PrinterSetupDialog(); + virtual void dispose() SAL_OVERRIDE; void SetPrinter( Printer* pNewPrinter ) { mpPrinter = pNewPrinter; } Printer* GetPrinter() const { return mpPrinter; } diff --git a/include/svtools/roadmapwizard.hxx b/include/svtools/roadmapwizard.hxx index 578ba284adb8..7ff79e044d9c 100644 --- a/include/svtools/roadmapwizard.hxx +++ b/include/svtools/roadmapwizard.hxx @@ -77,6 +77,7 @@ namespace svt sal_uInt32 _nButtonFlags = WZB_NEXT | WZB_PREVIOUS | WZB_FINISH | WZB_CANCEL | WZB_HELP ); virtual ~RoadmapWizard( ); + virtual void dispose() SAL_OVERRIDE; void SetRoadmapHelpId( const OString& _rId ); @@ -89,7 +90,7 @@ namespace svt virtual bool canAdvance() const SAL_OVERRIDE; virtual void updateTravelUI() SAL_OVERRIDE; -protected: + protected: /** declares a valid path in the wizard The very first path which is declared is automatically activated. diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index 16d5d692594e..9f2ba57093da 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -728,6 +728,7 @@ protected: public: Ruler( vcl::Window* pParent, WinBits nWinStyle = WB_STDRULER ); virtual ~Ruler(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/scrwin.hxx b/include/svtools/scrwin.hxx index bde616ac321e..2eac5980725a 100644 --- a/include/svtools/scrwin.hxx +++ b/include/svtools/scrwin.hxx @@ -21,8 +21,8 @@ #define INCLUDED_SVTOOLS_SCRWIN_HXX #include <svtools/svtdllapi.h> - #include <vcl/scrbar.hxx> +#include <vcl/vclptr.hxx> class DataChangedEvent; @@ -49,9 +49,9 @@ private: long nLinePixH; // size of a line/column (pixel) long nColumnPixW; - ScrollBar aVScroll; // the scrollbars - ScrollBar aHScroll; - ScrollBarBox aCornerWin; // window in the bottom right corner + VclPtr<ScrollBar> aVScroll; // the scrollbars + VclPtr<ScrollBar> aHScroll; + VclPtr<ScrollBarBox> aCornerWin; // window in the bottom right corner bool bScrolling:1, // user controlled scrolling bHandleDragging:1, // scroll window while dragging bHCenter:1, @@ -64,6 +64,8 @@ private: public: ScrollableWindow( vcl::Window* pParent, WinBits nBits = 0, ScrollableWindowFlags = SCRWIN_DEFAULT ); + virtual ~ScrollableWindow(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE; diff --git a/include/svtools/simptabl.hxx b/include/svtools/simptabl.hxx index b8414851256c..7670b7f74cc7 100644 --- a/include/svtools/simptabl.hxx +++ b/include/svtools/simptabl.hxx @@ -53,7 +53,7 @@ private: Link aHeaderBarDblClickLink; Link aCommandLink; CommandEvent aCEvt; - HeaderBar aHeaderBar; + VclPtr<HeaderBar> aHeaderBar; long nOldPos; sal_uInt16 nHeaderItemId; bool bPaintFlag; @@ -89,6 +89,7 @@ public: SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER); virtual ~SvSimpleTable(); + virtual void dispose() SAL_OVERRIDE; void UpdateViewSize(); @@ -126,9 +127,9 @@ public: void SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; } const Link& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; } - void SetHeaderBarHelpId(const OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);} + void SetHeaderBarHelpId(const OString& rHelpId) { aHeaderBar->SetHelpId(rHelpId); } - HeaderBar& GetTheHeaderBar() {return aHeaderBar;} + HeaderBar& GetTheHeaderBar() { return *aHeaderBar.get(); } }; diff --git a/include/svtools/svmedit2.hxx b/include/svtools/svmedit2.hxx index 2e17023629c9..d6c30d26872b 100644 --- a/include/svtools/svmedit2.hxx +++ b/include/svtools/svmedit2.hxx @@ -28,7 +28,6 @@ class SVT_DLLPUBLIC ExtMultiLineEdit : public MultiLineEdit { public: ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle = WB_LEFT | WB_BORDER ); - virtual ~ExtMultiLineEdit(); // methods of TextView void InsertText( const OUString& rNew, bool bSelect = false ); @@ -37,7 +36,7 @@ public: // methods of TextEngine void SetAttrib( const TextAttrib& rAttr, sal_uLong nPara, sal_uInt16 nStart, sal_uInt16 nEnd ); void SetLeftMargin( sal_uInt16 nLeftMargin ); - sal_uLong GetParagraphCount() const; + sal_uLong GetParagraphCount() const; }; #endif diff --git a/include/svtools/svtabbx.hxx b/include/svtools/svtabbx.hxx index 92c04fc489da..1aa1622dba88 100644 --- a/include/svtools/svtabbx.hxx +++ b/include/svtools/svtabbx.hxx @@ -65,8 +65,9 @@ protected: public: SvTabListBox( vcl::Window* pParent, WinBits = WB_BORDER ); virtual ~SvTabListBox(); + virtual void dispose() SAL_OVERRIDE; void SetTabs(const long* pTabs, MapUnit = MAP_APPFONT); - sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; } + sal_uInt16 TabCount() const { return (sal_uInt16)nTabCount; } using SvTreeListBox::GetTab; long GetTab( sal_uInt16 nTab ) const; void SetTab( sal_uInt16 nTab, long nValue, MapUnit = MAP_APPFONT ); @@ -139,6 +140,7 @@ private: public: SvHeaderTabListBox( vcl::Window* pParent, WinBits nBits ); virtual ~SvHeaderTabListBox(); + virtual void dispose() SAL_OVERRIDE; virtual void Paint( const Rectangle& ) SAL_OVERRIDE; diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index d9a858907a82..be31ee6bafa0 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -384,6 +384,7 @@ public: TabBar( vcl::Window* pParent, WinBits nWinStyle = WB_STDTABBAR ); virtual ~TabBar(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/toolbarmenu.hxx b/include/svtools/toolbarmenu.hxx index 2b20a31c5f2f..598dec3bf97e 100644 --- a/include/svtools/toolbarmenu.hxx +++ b/include/svtools/toolbarmenu.hxx @@ -51,6 +51,7 @@ public: WinBits nBits ); virtual ~ToolbarMenu(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/toolpanel/paneltabbar.hxx b/include/svtools/toolpanel/paneltabbar.hxx index 18e4d1ea1197..3e20b2dede70 100644 --- a/include/svtools/toolpanel/paneltabbar.hxx +++ b/include/svtools/toolpanel/paneltabbar.hxx @@ -52,6 +52,7 @@ namespace svt public: PanelTabBar( vcl::Window& i_rParentWindow, IToolPanelDeck& i_rPanelDeck, const TabAlignment i_eAlignment, const TabItemContent i_eItemContent ); virtual ~PanelTabBar(); + virtual void dispose() SAL_OVERRIDE; // attribute access TabItemContent GetTabItemContent() const; diff --git a/include/svtools/toolpanel/toolpaneldeck.hxx b/include/svtools/toolpanel/toolpaneldeck.hxx index d9c06ced6771..211c099deb93 100644 --- a/include/svtools/toolpanel/toolpaneldeck.hxx +++ b/include/svtools/toolpanel/toolpaneldeck.hxx @@ -138,6 +138,7 @@ namespace svt public: ToolPanelDeck( vcl::Window& i_rParent, const WinBits i_nStyle = WB_DIALOGCONTROL ); virtual ~ToolPanelDeck(); + virtual void dispose() SAL_OVERRIDE; // attributes PDeckLayouter GetLayouter() const; diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx index f7c1af30cc4b..cbac8ed98e65 100644 --- a/include/svtools/treelistbox.hxx +++ b/include/svtools/treelistbox.hxx @@ -336,6 +336,7 @@ public: SvTreeListBox( vcl::Window* pParent, WinBits nWinStyle=0 ); SvTreeListBox( vcl::Window* pParent, const ResId& rResId ); virtual ~SvTreeListBox(); + virtual void dispose() SAL_OVERRIDE; SvTreeList* GetModel() const { diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index baebae42db8c..b9753d2eee1a 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -284,7 +284,8 @@ protected: public: ValueSet( vcl::Window* pParent, WinBits nWinStyle, bool bDisableTransientChildren = false ); ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTransientChildren = false ); - virtual ~ValueSet(); + virtual ~ValueSet(); + virtual void dispose() SAL_OVERRIDE; virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE; diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx index 56bd679a0d89..053acdce08a2 100644 --- a/include/svtools/wizardmachine.hxx +++ b/include/svtools/wizardmachine.hxx @@ -100,6 +100,7 @@ namespace svt */ OWizardPage(vcl::Window *pParent, const OString& rID, const OUString& rUIXMLDescription); virtual ~OWizardPage(); + virtual void dispose() SAL_OVERRIDE; // IWizardPageController overridables virtual void initializePage() SAL_OVERRIDE; @@ -175,6 +176,7 @@ namespace svt OWizardMachine(vcl::Window* _pParent, const WinBits i_nStyle, sal_uInt32 _nButtonFlags ); OWizardMachine(vcl::Window* _pParent, sal_uInt32 _nButtonFlags ); virtual ~OWizardMachine(); + virtual void dispose() SAL_OVERRIDE; /// enable (or disable) buttons void enableButtons(sal_uInt32 _nWizardButtonFlags, bool _bEnable); diff --git a/include/svtools/wizdlg.hxx b/include/svtools/wizdlg.hxx index 93d19addf6ed..498aa9c437ed 100644 --- a/include/svtools/wizdlg.hxx +++ b/include/svtools/wizdlg.hxx @@ -242,6 +242,7 @@ public: WizardDialog( vcl::Window* pParent, WinBits nStyle = WB_STDTABDIALOG ); WizardDialog( vcl::Window* pParent, const OUString& rID, const OUString& rUIXMLDescription ); virtual ~WizardDialog(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE; diff --git a/include/toolkit/awt/scrollabledialog.hxx b/include/toolkit/awt/scrollabledialog.hxx index e75fac70b0ed..70e2b32be919 100644 --- a/include/toolkit/awt/scrollabledialog.hxx +++ b/include/toolkit/awt/scrollabledialog.hxx @@ -43,8 +43,8 @@ namespace toolkit template < class T > class ScrollableWrapper : public T, public ScrollableInterface { - ScrollBar maHScrollBar; - ScrollBar maVScrollBar; + VclPtr<ScrollBar> maHScrollBar; + VclPtr<ScrollBar> maVScrollBar; Size maScrollArea; bool mbHasHoriBar; bool mbHasVertBar; @@ -59,6 +59,7 @@ namespace toolkit public: ScrollableWrapper( vcl::Window* pParent, WinBits nStyle = WB_STDDIALOG ); virtual ~ScrollableWrapper(); + virtual void dispose() SAL_OVERRIDE; virtual void SetScrollWidth( long nWidth ) SAL_OVERRIDE; virtual long GetScrollWidth() SAL_OVERRIDE { return maScrollArea.Width(); } virtual void SetScrollHeight( long nHeight ) SAL_OVERRIDE; diff --git a/svtools/inc/roadmap.hxx b/svtools/inc/roadmap.hxx index c12e7449a725..b4b75782e17c 100644 --- a/svtools/inc/roadmap.hxx +++ b/svtools/inc/roadmap.hxx @@ -58,6 +58,7 @@ namespace svt public: ORoadmap( vcl::Window* _pParent, WinBits _nWinStyle = 0 ); virtual ~ORoadmap( ); + virtual void dispose() SAL_OVERRIDE; void SetRoadmapBitmap( const BitmapEx& maBitmap, bool _bInvalidate = true ); diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx index e4b7cbf26cea..22242efc5304 100644 --- a/svtools/inc/table/tablecontrol.hxx +++ b/svtools/inc/table/tablecontrol.hxx @@ -64,6 +64,7 @@ namespace svt { namespace table public: TableControl( vcl::Window* _pParent, WinBits _nStyle ); virtual ~TableControl(); + virtual void dispose() SAL_OVERRIDE; /// sets a new table model void SetModel( PTableModel _pModel ); diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 67353f473e22..5b5de370fae3 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -101,9 +101,9 @@ void BrowseBox::ConstructImpl( BrowserMode nMode ) nControlAreaWidth = USHRT_MAX; uRow.nSel = BROWSER_ENDOFSELECTION; - aHScroll.SetLineSize(1); - aHScroll.SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) ); - aHScroll.SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) ); + aHScroll->SetLineSize(1); + aHScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) ); + aHScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) ); pDataWin->Show(); SetMode( nMode ); @@ -119,7 +119,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, WinBits nBits, BrowserMode nMode ) :Control( pParent, nBits | WB_3DLOOK ) ,DragSourceHelper( this ) ,DropTargetHelper( this ) - ,aHScroll( this, WinBits( WB_HSCROLL ) ) + ,aHScroll( new ScrollBar(this, WinBits( WB_HSCROLL )) ) { ConstructImpl( nMode ); } @@ -130,7 +130,7 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode :Control( pParent, rId ) ,DragSourceHelper( this ) ,DropTargetHelper( this ) - ,aHScroll( this, WinBits(WB_HSCROLL) ) + ,aHScroll( new ScrollBar(this, WinBits(WB_HSCROLL)) ) { ConstructImpl(nMode); } @@ -138,6 +138,11 @@ BrowseBox::BrowseBox( vcl::Window* pParent, const ResId& rId, BrowserMode nMode BrowseBox::~BrowseBox() { + dispose(); +} + +void BrowseBox::dispose() +{ OSL_TRACE( "BrowseBox: %p~", this ); if ( m_pImpl->m_pAccessible ) @@ -152,6 +157,7 @@ BrowseBox::~BrowseBox() delete getDataWindow()->pCornerWin; delete pDataWin; delete pVScroll; + aHScroll.disposeAndClear(); // free columns-space for ( size_t i = 0, n = pCols->size(); i < n; ++i ) @@ -161,6 +167,7 @@ BrowseBox::~BrowseBox() delete pColSel; if ( bMultiSelection ) delete uRow.pSel; + Control::dispose(); } @@ -917,7 +924,7 @@ long BrowseBox::ScrollColumns( long nCols ) { // update internal value and scrollbar ++nFirstCol; - aHScroll.SetThumbPos( nFirstCol - FrozenColCount() ); + aHScroll->SetThumbPos( nFirstCol - FrozenColCount() ); if ( !bScrollable ) { @@ -963,7 +970,7 @@ long BrowseBox::ScrollColumns( long nCols ) else if ( nCols == -1 ) { --nFirstCol; - aHScroll.SetThumbPos( nFirstCol - FrozenColCount() ); + aHScroll->SetThumbPos( nFirstCol - FrozenColCount() ); if ( !bScrollable ) { @@ -1003,7 +1010,7 @@ long BrowseBox::ScrollColumns( long nCols ) } nFirstCol = nFirstCol + (sal_uInt16)nCols; - aHScroll.SetThumbPos( nFirstCol - FrozenColCount() ); + aHScroll->SetThumbPos( nFirstCol - FrozenColCount() ); } // adjust external headerbar, if necessary @@ -1141,7 +1148,7 @@ void BrowseBox::Clear() // nFirstCol may not be reset, else the scrolling code will become confused. // nFirstCol may only be changed when adding or deleting columns // nFirstCol = 0; -> wrong! - aHScroll.SetThumbPos( 0 ); + aHScroll->SetThumbPos( 0 ); pVScroll->SetThumbPos( 0 ); Invalidate(); @@ -2213,9 +2220,9 @@ Rectangle BrowseBox::GetControlArea() const { return Rectangle( - Point( 0, GetOutputSizePixel().Height() - aHScroll.GetSizePixel().Height() ), - Size( GetOutputSizePixel().Width() - aHScroll.GetSizePixel().Width(), - aHScroll.GetSizePixel().Height() ) ); + Point( 0, GetOutputSizePixel().Height() - aHScroll->GetSizePixel().Height() ), + Size( GetOutputSizePixel().Width() - aHScroll->GetSizePixel().Width(), + aHScroll->GetSizePixel().Height() ) ); } @@ -2238,7 +2245,7 @@ void BrowseBox::SetMode( BrowserMode nMode ) getDataWindow()->bNoVScroll = false; if ( getDataWindow()->bNoHScroll ) - aHScroll.Hide(); + aHScroll->Hide(); nControlAreaWidth = USHRT_MAX; diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 2b2afb754054..d931547c13c0 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -139,7 +139,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange ) HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar; if ( pHeaderBar ) pHeaderBar->EnableRTL( IsRTLEnabled() ); - aHScroll.EnableRTL( IsRTLEnabled() ); + aHScroll->EnableRTL( IsRTLEnabled() ); if( pVScroll ) pVScroll->EnableRTL( IsRTLEnabled() ); Resize(); @@ -561,13 +561,13 @@ void BrowseBox::Resize() // did we need a horizontal scroll bar or is there a Control Area? if ( !getDataWindow()->bNoHScroll && ( ( pCols->size() - FrozenColCount() ) > 1 ) ) - aHScroll.Show(); + aHScroll->Show(); else - aHScroll.Hide(); + aHScroll->Hide(); // calculate the size of the data window long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight(); - if ( aHScroll.IsVisible() || ( nControlAreaWidth != USHRT_MAX ) ) + if ( aHScroll->IsVisible() || ( nControlAreaWidth != USHRT_MAX ) ) nDataHeight -= nSBSize; long nDataWidth = GetOutputSizePixel().Width(); @@ -627,9 +627,9 @@ void BrowseBox::Paint( const Rectangle& rRect ) // draw delimitational lines if ( !getDataWindow()->bNoHScroll ) - DrawLine( Point( 0, aHScroll.GetPosPixel().Y() ), + DrawLine( Point( 0, aHScroll->GetPosPixel().Y() ), Point( GetOutputSizePixel().Width(), - aHScroll.GetPosPixel().Y() ) ); + aHScroll->GetPosPixel().Y() ) ); if ( nTitleLines ) { @@ -1169,15 +1169,15 @@ void BrowseBox::UpdateScrollbars() : !getDataWindow()->bNoHScroll; if ( !bNeedsHScroll ) { - if ( aHScroll.IsVisible() ) + if ( aHScroll->IsVisible() ) { - aHScroll.Hide(); + aHScroll->Hide(); } aDataWinSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight(); if ( nControlAreaWidth != USHRT_MAX ) aDataWinSize.Height() -= nCornerSize; } - else if ( !aHScroll.IsVisible() ) + else if ( !aHScroll->IsVisible() ) { Size aNewSize( aDataWinSize ); aNewSize.Height() = GetOutputSizePixel().Height() - GetTitleHeight() - nCornerSize; @@ -1189,7 +1189,7 @@ void BrowseBox::UpdateScrollbars() ? 0 : nControlAreaWidth; - aHScroll.SetPosSizePixel( + aHScroll->SetPosSizePixel( Point( nHScrX, GetOutputSizePixel().Height() - nCornerSize ), Size( aDataWinSize.Width() - nHScrX, nCornerSize ) ); @@ -1202,10 +1202,10 @@ void BrowseBox::UpdateScrollbars() : (short)( nLastCol - nFirstCol ); short nRange = std::max( nScrollCols, (short)0 ); - aHScroll.SetVisibleSize( nVisibleHSize ); - aHScroll.SetRange( Range( 0, nRange )); - if ( bNeedsHScroll && !aHScroll.IsVisible() ) - aHScroll.Show(); + aHScroll->SetVisibleSize( nVisibleHSize ); + aHScroll->SetRange( Range( 0, nRange )); + if ( bNeedsHScroll && !aHScroll->IsVisible() ) + aHScroll->Show(); // adjust position and height of vertical scrollbar pVScroll->SetPageSize( nMaxRows ); @@ -1237,12 +1237,12 @@ void BrowseBox::UpdateScrollbars() // needs corner-window? // (do that AFTER positioning BOTH scrollbars) sal_uLong nActualCorderWidth = 0; - if (aHScroll.IsVisible() && pVScroll && pVScroll->IsVisible() ) + if (aHScroll->IsVisible() && pVScroll && pVScroll->IsVisible() ) { // if we have both scrollbars, the corner window fills the point of intersection of these two nActualCorderWidth = nCornerSize; } - else if ( !aHScroll.IsVisible() && ( nControlAreaWidth != USHRT_MAX ) ) + else if ( !aHScroll->IsVisible() && ( nControlAreaWidth != USHRT_MAX ) ) { // if we have no horizontal scrollbar, but a control area, we need the corner window to // fill the space between the control are and the right border @@ -1253,7 +1253,7 @@ void BrowseBox::UpdateScrollbars() if ( !getDataWindow()->pCornerWin ) getDataWindow()->pCornerWin = new ScrollBarBox( this, 0 ); getDataWindow()->pCornerWin->SetPosSizePixel( - Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll.GetPosPixel().Y() ), + Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ), Size( nActualCorderWidth, nCornerSize ) ); getDataWindow()->pCornerWin->Show(); } @@ -1371,8 +1371,8 @@ IMPL_LINK(BrowseBox,ScrollHdl,ScrollBar*,pBar) return 0; } - if ( pBar == &aHScroll ) - ScrollColumns( aHScroll.GetDelta() ); + if ( pBar == aHScroll.get() ) + ScrollColumns( aHScroll->GetDelta() ); if ( pBar == pVScroll ) ScrollRows( pVScroll->GetDelta() ); @@ -2050,7 +2050,7 @@ Rectangle BrowseBox::calcTableRect(bool _bOnScreen) long nY = aRowBar.Top() - aRect.Top(); Size aSize(aRect.GetSize()); - return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll.GetSizePixel().Height()) ); + return Rectangle(aRowBar.TopRight(), Size(aSize.A() - nX, aSize.B() - nY - aHScroll->GetSizePixel().Height()) ); } Rectangle BrowseBox::GetFieldRectPixelAbs( sal_Int32 _nRowId, sal_uInt16 _nColId, bool /*_bIsHeader*/, bool _bOnScreen ) diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index e56ef6b70de6..4faea385bf09 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -227,11 +227,17 @@ BrowserDataWin::BrowserDataWin( BrowseBox* pParent ) BrowserDataWin::~BrowserDataWin() { + dispose(); +} + +void BrowserDataWin::dispose() +{ bInDtor = true; for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i ) delete aInvalidRegion[ i ]; aInvalidRegion.clear(); + Control::dispose(); } @@ -408,7 +414,7 @@ void BrowserDataWin::Command( const CommandEvent& rEvt ) if ( ( (rEvt.GetCommand() == COMMAND_WHEEL) || (rEvt.GetCommand() == COMMAND_STARTAUTOSCROLL) || (rEvt.GetCommand() == COMMAND_AUTOSCROLL) ) && - ( HandleScrollCommand( rEvt, &pBox->aHScroll, pBox->pVScroll ) ) ) + ( HandleScrollCommand( rEvt, pBox->aHScroll.get(), pBox->pVScroll ) ) ) return; Point aEventPos( rEvt.GetMousePosPixel() ); diff --git a/svtools/source/brwbox/datwin.hxx b/svtools/source/brwbox/datwin.hxx index ef9cca2a51f8..b4fd34b0ff16 100644 --- a/svtools/source/brwbox/datwin.hxx +++ b/svtools/source/brwbox/datwin.hxx @@ -137,7 +137,8 @@ public: public: BrowserDataWin( BrowseBox* pParent ); - virtual ~BrowserDataWin(); + virtual ~BrowserDataWin(); + virtual void dispose() SAL_OVERRIDE; virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index c4bedd3c27bf..b078375ef2ce 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -249,7 +249,13 @@ namespace svt CheckBoxControl::~CheckBoxControl() { + dispose(); + } + + void CheckBoxControl::dispose() + { delete pBox; + Control::dispose(); } diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index c48a0a924943..597ce9433aa4 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -183,6 +183,11 @@ namespace svt EditBrowseBox::~EditBrowseBox() { + dispose(); + } + + void EditBrowseBox::dispose() + { if (nStartEvent) Application::RemoveUserEvent(nStartEvent); if (nEndEvent) @@ -191,7 +196,7 @@ namespace svt Application::RemoveUserEvent(nCellModifiedEvent); delete pCheckBoxPaint; - + BrowseBox::dispose(); } diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx index b5adc8962ec4..434920ae55f9 100644 --- a/svtools/source/contnr/DocumentInfoPreview.cxx +++ b/svtools/source/contnr/DocumentInfoPreview.cxx @@ -44,16 +44,26 @@ namespace svtools { ODocumentInfoPreview::ODocumentInfoPreview(vcl::Window * pParent, WinBits nBits): - Window(pParent, WB_DIALOGCONTROL), m_pEditWin(this, nBits), + Window(pParent, WB_DIALOGCONTROL), + m_pEditWin( new ExtMultiLineEdit(this, nBits) ), m_xInfoTable(new SvtDocInfoTable_Impl), m_aLanguageTag(SvtPathOptions().GetLanguageTag()) // detect application language { - m_pEditWin.SetLeftMargin(10); - m_pEditWin.Show(); - m_pEditWin.EnableCursor(false); + m_pEditWin->SetLeftMargin(10); + m_pEditWin->Show(); + m_pEditWin->EnableCursor(false); } -ODocumentInfoPreview::~ODocumentInfoPreview() {} +ODocumentInfoPreview::~ODocumentInfoPreview() +{ + dispose(); +} + +void ODocumentInfoPreview::dispose() +{ + m_pEditWin.disposeAndClear(); + Window::dispose(); +} extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(vcl::Window *pParent, VclBuilder::stringmap&) { @@ -61,11 +71,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeODocumentInfoPreview(v } void ODocumentInfoPreview::Resize() { - m_pEditWin.SetPosSizePixel(Point(0, 0), GetOutputSize()); + m_pEditWin->SetPosSizePixel(Point(0, 0), GetOutputSize()); } void ODocumentInfoPreview::clear() { - m_pEditWin.SetText(OUString()); + m_pEditWin->SetText(OUString()); } void ODocumentInfoPreview::fill( @@ -74,7 +84,7 @@ void ODocumentInfoPreview::fill( { assert(xDocProps.is()); - m_pEditWin.SetAutoScroll(false); + m_pEditWin->SetAutoScroll(false); insertNonempty(DI_TITLE, xDocProps->getTitle()); insertNonempty(DI_FROM, xDocProps->getAuthor()); @@ -126,22 +136,22 @@ void ODocumentInfoPreview::fill( } } - m_pEditWin.SetSelection(Selection(0, 0)); - m_pEditWin.SetAutoScroll(true); + m_pEditWin->SetSelection(Selection(0, 0)); + m_pEditWin->SetAutoScroll(true); } void ODocumentInfoPreview::insertEntry( OUString const & title, OUString const & value) { - if (!m_pEditWin.GetText().isEmpty()) { - m_pEditWin.InsertText(OUString("\n\n")); + if (!m_pEditWin->GetText().isEmpty()) { + m_pEditWin->InsertText(OUString("\n\n")); } OUString caption(title + ":\n"); - m_pEditWin.InsertText(caption); - m_pEditWin.SetAttrib( - TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin.GetParagraphCount() - 2, + m_pEditWin->InsertText(caption); + m_pEditWin->SetAttrib( + TextAttribFontWeight(WEIGHT_BOLD), m_pEditWin->GetParagraphCount() - 2, 0, caption.getLength() - 1); - m_pEditWin.InsertText(value); + m_pEditWin->InsertText(value); } void ODocumentInfoPreview::insertNonempty(long id, OUString const & value) diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 8ec816f3af49..e5ffac447d1b 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -192,7 +192,8 @@ protected: public: ViewTabListBox_Impl( vcl::Window* pParentWin, SvtFileView_Impl* pParent, sal_Int16 nFlags ); - virtual ~ViewTabListBox_Impl(); + virtual ~ViewTabListBox_Impl(); + virtual void dispose() SAL_OVERRIDE; virtual void Resize() SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; @@ -634,9 +635,15 @@ ViewTabListBox_Impl::ViewTabListBox_Impl( vcl::Window* pParentWin, ViewTabListBox_Impl::~ViewTabListBox_Impl() { + dispose(); +} + +void ViewTabListBox_Impl::dispose() +{ maResetQuickSearch.Stop(); delete mpHeaderBar; + SvHeaderTabListBox::dispose(); } @@ -1089,10 +1096,16 @@ SvtFileView::SvtFileView( vcl::Window* pParent, WinBits nBits, SvtFileView::~SvtFileView() { + dispose(); +} + +void SvtFileView::dispose() +{ // use temp pointer to prevent access of deleted member (GetFocus()) SvtFileView_Impl* pTemp = mpImp; mpImp = NULL; delete pTemp; + Control::dispose(); } extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvtFileView(vcl::Window *pParent, diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index da249561ffe4..71a175195db1 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -24,6 +24,7 @@ #include <vcl/scrbar.hxx> #include <vcl/timer.hxx> #include <vcl/idle.hxx> +#include <vcl/vclptr.hxx> #include <vcl/seleng.hxx> #include <tools/debug.hxx> #include "svtaccessiblefactory.hxx" @@ -160,9 +161,9 @@ class SvxIconChoiceCtrl_Impl bool bChooseWithCursor; EntryList_Impl aEntries; - ScrollBar aVerSBar; - ScrollBar aHorSBar; - ScrollBarBox aScrBarBox; + VclPtr<ScrollBar> aVerSBar; + VclPtr<ScrollBar> aHorSBar; + VclPtr<ScrollBarBox> aScrBarBox; Rectangle aCurSelectionRect; std::vector<Rectangle*> aSelectedRectList; Idle aEditIdle; // for editing in place diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index c46df0507255..2f9c39c732ce 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -77,7 +77,8 @@ public: const OUString& rData, const Link& rNotifyEditEnd ); - virtual ~IcnViewEdit_Impl(); + virtual ~IcnViewEdit_Impl(); + virtual void dispose() SAL_OVERRIDE; virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE; virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; bool EditingCanceled() const { return bCanceled; } @@ -90,9 +91,9 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( WinBits nWinStyle ) : aEntries( this ), - aVerSBar( pCurView, WB_DRAG | WB_VSCROLL ), - aHorSBar( pCurView, WB_DRAG | WB_HSCROLL ), - aScrBarBox( pCurView ), + aVerSBar( new ScrollBar(pCurView, WB_DRAG | WB_VSCROLL) ), + aHorSBar( new ScrollBar(pCurView, WB_DRAG | WB_HSCROLL) ), + aScrBarBox( new ScrollBarBox(pCurView) ), aImageSize( 32, 32 ), pColumns( 0 ) { @@ -127,14 +128,14 @@ SvxIconChoiceCtrl_Impl::SvxIconChoiceCtrl_Impl( pImpCursor = new IcnCursor_Impl( this ); pGridMap = new IcnGridMap_Impl( this ); - aVerSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) ); - aHorSBar.SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) ); + aVerSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollUpDownHdl ) ); + aHorSBar->SetScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, ScrollLeftRightHdl ) ); Link aEndScrollHdl( LINK( this, SvxIconChoiceCtrl_Impl, EndScrollHdl ) ); - aVerSBar.SetEndScrollHdl( aEndScrollHdl ); - aHorSBar.SetEndScrollHdl( aEndScrollHdl ); + aVerSBar->SetEndScrollHdl( aEndScrollHdl ); + aHorSBar->SetEndScrollHdl( aEndScrollHdl ); - nHorSBarHeight = aHorSBar.GetSizePixel().Height(); - nVerSBarWidth = aVerSBar.GetSizePixel().Width(); + nHorSBarHeight = aHorSBar->GetSizePixel().Height(); + nVerSBarWidth = aVerSBar->GetSizePixel().Width(); aEditIdle.SetPriority( SchedulerPriority::LOWEST ); aEditIdle.SetIdleHdl(LINK(this,SvxIconChoiceCtrl_Impl,EditTimeoutHdl)); @@ -169,6 +170,10 @@ SvxIconChoiceCtrl_Impl::~SvxIconChoiceCtrl_Impl() delete pEntryPaintDev; ClearSelectedRectList(); ClearColumnList(); + aVerSBar.disposeAndClear(); + aHorSBar.disposeAndClear(); + aScrBarBox.disposeAndClear(); + } void SvxIconChoiceCtrl_Impl::Clear( bool bInCtor ) @@ -499,11 +504,11 @@ void SvxIconChoiceCtrl_Impl::AdjustVirtSize( const Rectangle& rRect ) Range aRange; aVirtOutputSize.Width() += nWidthOffs; aRange.Max() = aVirtOutputSize.Width(); - aHorSBar.SetRange( aRange ); + aHorSBar->SetRange( aRange ); aVirtOutputSize.Height() += nHeightOffs; aRange.Max() = aVirtOutputSize.Height(); - aVerSBar.SetRange( aRange ); + aVerSBar->SetRange( aRange ); pImpCursor->Clear(); pGridMap->OutputSizeChanged(); @@ -749,9 +754,9 @@ void SvxIconChoiceCtrl_Impl::RepaintEntries( sal_uInt16 nEntryFlagsMask ) void SvxIconChoiceCtrl_Impl::InitScrollBarBox() { - aScrBarBox.SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) ); + aScrBarBox->SetSizePixel( Size(nVerSBarWidth-1, nHorSBarHeight-1) ); Size aSize( pView->GetOutputSizePixel() ); - aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1)); + aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth+1, aSize.Height()-nHorSBarHeight+1)); } bool SvxIconChoiceCtrl_Impl::MouseButtonDown( const MouseEvent& rMEvt) @@ -1251,8 +1256,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig Point aPos( 0, nRealHeight ); aPos.Y() -= nHorSBarHeight; - if( aHorSBar.GetPosPixel() != aPos ) - aHorSBar.SetPosPixel( aPos ); + if( aHorSBar->GetPosPixel() != aPos ) + aHorSBar->SetPosPixel( aPos ); // vertical scrollbar aPos.X() = nRealWidth; aPos.Y() = 0; @@ -1260,8 +1265,8 @@ void SvxIconChoiceCtrl_Impl::PositionScrollBars( long nRealWidth, long nRealHeig aPos.X()++; aPos.Y()--; - if( aVerSBar.GetPosPixel() != aPos ) - aVerSBar.SetPosPixel( aPos ); + if( aVerSBar->GetPosPixel() != aPos ) + aVerSBar->SetPosPixel( aPos ); } void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool ) @@ -1340,27 +1345,27 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool ) } // size vertical scrollbar - long nThumb = aVerSBar.GetThumbPos(); + long nThumb = aVerSBar->GetThumbPos(); Size aSize( nVerSBarWidth, nRealHeight ); aSize.Height() += 2; - if( aSize != aVerSBar.GetSizePixel() ) - aVerSBar.SetSizePixel( aSize ); - aVerSBar.SetVisibleSize( nVisibleHeight ); - aVerSBar.SetPageSize( GetScrollBarPageSize( nVisibleHeight )); + if( aSize != aVerSBar->GetSizePixel() ) + aVerSBar->SetSizePixel( aSize ); + aVerSBar->SetVisibleSize( nVisibleHeight ); + aVerSBar->SetPageSize( GetScrollBarPageSize( nVisibleHeight )); if( nResult & 0x0001 ) { - aVerSBar.SetThumbPos( nThumb ); - aVerSBar.Show(); + aVerSBar->SetThumbPos( nThumb ); + aVerSBar->Show(); } else { - aVerSBar.SetThumbPos( 0 ); - aVerSBar.Hide(); + aVerSBar->SetThumbPos( 0 ); + aVerSBar->Hide(); } // size horizontal scrollbar - nThumb = aHorSBar.GetThumbPos(); + nThumb = aHorSBar->GetThumbPos(); aSize.Width() = nRealWidth; aSize.Height() = nHorSBarHeight; aSize.Width()++; @@ -1369,19 +1374,19 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool ) aSize.Width()++; nRealWidth++; } - if( aSize != aHorSBar.GetSizePixel() ) - aHorSBar.SetSizePixel( aSize ); - aHorSBar.SetVisibleSize( nVisibleWidth ); - aHorSBar.SetPageSize( GetScrollBarPageSize(nVisibleWidth )); + if( aSize != aHorSBar->GetSizePixel() ) + aHorSBar->SetSizePixel( aSize ); + aHorSBar->SetVisibleSize( nVisibleWidth ); + aHorSBar->SetPageSize( GetScrollBarPageSize(nVisibleWidth )); if( nResult & 0x0002 ) { - aHorSBar.SetThumbPos( nThumb ); - aHorSBar.Show(); + aHorSBar->SetThumbPos( nThumb ); + aHorSBar->Show(); } else { - aHorSBar.SetThumbPos( 0 ); - aHorSBar.Hide(); + aHorSBar->SetThumbPos( 0 ); + aHorSBar->Hide(); } aOutputSize.Width() = nRealWidth; @@ -1390,9 +1395,9 @@ void SvxIconChoiceCtrl_Impl::AdjustScrollBars( bool ) aOutputSize.Height() = nRealHeight; if( (nResult & (0x0001|0x0002)) == (0x0001|0x0002) ) - aScrBarBox.Show(); + aScrBarBox->Show(); else - aScrBarBox.Hide(); + aScrBarBox->Hide(); } void SvxIconChoiceCtrl_Impl::Resize() @@ -1420,7 +1425,7 @@ void SvxIconChoiceCtrl_Impl::Resize() bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar() { - if( !pZOrderList || !aHorSBar.IsVisible() ) + if( !pZOrderList || !aHorSBar->IsVisible() ) return false; const MapMode& rMapMode = pView->GetMapMode(); Point aOrigin( rMapMode.GetOrigin() ); @@ -1438,18 +1443,18 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar() if( nRight > nMostRight ) nMostRight = nRight; } - aHorSBar.Hide(); + aHorSBar->Hide(); aOutputSize.Height() += nHorSBarHeight; aVirtOutputSize.Width() = nMostRight; - aHorSBar.SetThumbPos( 0 ); + aHorSBar->SetThumbPos( 0 ); Range aRange; aRange.Max() = nMostRight - 1; - aHorSBar.SetRange( aRange ); - if( aVerSBar.IsVisible() ) + aHorSBar->SetRange( aRange ); + if( aVerSBar->IsVisible() ) { - Size aSize( aVerSBar.GetSizePixel()); + Size aSize( aVerSBar->GetSizePixel()); aSize.Height() += nHorSBarHeight; - aVerSBar.SetSizePixel( aSize ); + aVerSBar->SetSizePixel( aSize ); } return true; } @@ -1458,7 +1463,7 @@ bool SvxIconChoiceCtrl_Impl::CheckHorScrollBar() bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar() { - if( !pZOrderList || !aVerSBar.IsVisible() ) + if( !pZOrderList || !aVerSBar->IsVisible() ) return false; const MapMode& rMapMode = pView->GetMapMode(); Point aOrigin( rMapMode.GetOrigin() ); @@ -1476,18 +1481,18 @@ bool SvxIconChoiceCtrl_Impl::CheckVerScrollBar() if( nBottom > nDeepest ) nDeepest = nBottom; } - aVerSBar.Hide(); + aVerSBar->Hide(); aOutputSize.Width() += nVerSBarWidth; aVirtOutputSize.Height() = nDeepest; - aVerSBar.SetThumbPos( 0 ); + aVerSBar->SetThumbPos( 0 ); Range aRange; aRange.Max() = nDeepest - 1; - aVerSBar.SetRange( aRange ); - if( aHorSBar.IsVisible() ) + aVerSBar->SetRange( aRange ); + if( aHorSBar->IsVisible() ) { - Size aSize( aHorSBar.GetSizePixel()); + Size aSize( aHorSBar->GetSizePixel()); aSize.Width() += nVerSBarWidth; - aHorSBar.SetSizePixel( aSize ); + aHorSBar->SetSizePixel( aSize ); } return true; } @@ -1501,10 +1506,10 @@ void SvxIconChoiceCtrl_Impl::CheckScrollBars() CheckVerScrollBar(); if( CheckHorScrollBar() ) CheckVerScrollBar(); - if( aVerSBar.IsVisible() && aHorSBar.IsVisible() ) - aScrBarBox.Show(); + if( aVerSBar->IsVisible() && aHorSBar->IsVisible() ) + aScrBarBox->Show(); else - aScrBarBox.Hide(); + aScrBarBox->Hide(); } @@ -1779,7 +1784,7 @@ void SvxIconChoiceCtrl_Impl::PaintEntry( SvxIconChoiceCtrlEntry* pEntry, const P } bool bResetClipRegion = false; - if( !pView->IsClipRegion() && (aVerSBar.IsVisible() || aHorSBar.IsVisible()) ) + if( !pView->IsClipRegion() && (aVerSBar->IsVisible() || aHorSBar->IsVisible()) ) { Rectangle aOutputArea( GetOutputRect() ); if( aOutputArea.IsOver(aTextRect) || aOutputArea.IsOver(aBmpRect) ) @@ -2421,16 +2426,16 @@ void SvxIconChoiceCtrl_Impl::MakeVisible( const Rectangle& rRect, bool bScrBar, else pView->Invalidate(INVALIDATE_NOCHILDREN); - if( aHorSBar.IsVisible() || aVerSBar.IsVisible() ) + if( aHorSBar->IsVisible() || aVerSBar->IsVisible() ) { if( !bScrBar ) { aOrigin *= -1; // correct thumbs - if(aHorSBar.IsVisible() && aHorSBar.GetThumbPos() != aOrigin.X()) - aHorSBar.SetThumbPos( aOrigin.X() ); - if(aVerSBar.IsVisible() && aVerSBar.GetThumbPos() != aOrigin.Y()) - aVerSBar.SetThumbPos( aOrigin.Y() ); + if(aHorSBar->IsVisible() && aHorSBar->GetThumbPos() != aOrigin.X()) + aHorSBar->SetThumbPos( aOrigin.X() ); + if(aVerSBar->IsVisible() && aVerSBar->GetThumbPos() != aOrigin.Y()) + aVerSBar->SetThumbPos( aOrigin.Y() ); } } @@ -3275,11 +3280,17 @@ IcnViewEdit_Impl::IcnViewEdit_Impl( SvtIconChoiceCtrl* pParent, const Point& rPo IcnViewEdit_Impl::~IcnViewEdit_Impl() { + dispose(); +} + +void IcnViewEdit_Impl::dispose() +{ if( !bAlreadyInCallback ) { Application::RemoveAccel( &aAccReturn ); Application::RemoveAccel( &aAccEscape ); } + MultiLineEdit::dispose(); } void IcnViewEdit_Impl::CallCallBackHdl_Impl() @@ -3392,16 +3403,16 @@ void SvxIconChoiceCtrl_Impl::InitSettings() if( nScrBarSize != nHorSBarHeight || nScrBarSize != nVerSBarWidth ) { nHorSBarHeight = nScrBarSize; - Size aSize( aHorSBar.GetSizePixel() ); + Size aSize( aHorSBar->GetSizePixel() ); aSize.Height() = nScrBarSize; - aHorSBar.Hide(); - aHorSBar.SetSizePixel( aSize ); + aHorSBar->Hide(); + aHorSBar->SetSizePixel( aSize ); nVerSBarWidth = nScrBarSize; - aSize = aVerSBar.GetSizePixel(); + aSize = aVerSBar->GetSizePixel(); aSize.Width() = nScrBarSize; - aVerSBar.Hide(); - aVerSBar.SetSizePixel( aSize ); + aVerSBar->Hide(); + aVerSBar->SetSizePixel( aSize ); Size aOSize( pView->Control::GetOutputSizePixel() ); PositionScrollBars( aOSize.Width(), aOSize.Height() ); diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index ce1c05c49f64..1baa80cdd890 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -88,8 +88,14 @@ SvtIconChoiceCtrl::SvtIconChoiceCtrl( vcl::Window* pParent, WinBits nWinStyle ) SvtIconChoiceCtrl::~SvtIconChoiceCtrl() { + dispose(); +} + +void SvtIconChoiceCtrl::dispose() +{ _pImp->CallEventListeners( VCLEVENT_OBJECT_DYING ); delete _pImp; + Control::dispose(); } SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::InsertEntry( const OUString& rText, const Image& rImage, sal_uLong nPos, const Point* pPos, sal_uInt16 nFlags ) diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx index a6e07c52d7fc..aab0683c85dd 100644 --- a/svtools/source/contnr/simptabl.cxx +++ b/svtools/source/contnr/simptabl.cxx @@ -81,7 +81,7 @@ void SvSimpleTableContainer::GetFocus() SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits): SvHeaderTabListBox(&rParent, nBits | WB_CLIPCHILDREN | WB_HSCROLL | WB_TABSTOP), m_rParentTableContainer(rParent), - aHeaderBar(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP), + aHeaderBar(new HeaderBar(&rParent,WB_BUTTONSTYLE | WB_BORDER | WB_TABSTOP)), nHeaderItemId(1), bPaintFlag(true), aCollator(*(IntlWrapper( Application::GetSettings().GetLanguageTag() ).getCaseCollator())) @@ -92,40 +92,47 @@ SvSimpleTable::SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits): nSortCol = 0xFFFF; nOldPos = 0; - aHeaderBar.SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl)); - aHeaderBar.SetDragHdl(LINK( this, SvSimpleTable, DragHdl)); - aHeaderBar.SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl)); - aHeaderBar.SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick)); - aHeaderBar.SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick)); + aHeaderBar->SetStartDragHdl(LINK( this, SvSimpleTable, StartDragHdl)); + aHeaderBar->SetDragHdl(LINK( this, SvSimpleTable, DragHdl)); + aHeaderBar->SetEndDragHdl(LINK( this, SvSimpleTable, EndDragHdl)); + aHeaderBar->SetSelectHdl(LINK( this, SvSimpleTable, HeaderBarClick)); + aHeaderBar->SetDoubleClickHdl(LINK( this, SvSimpleTable, HeaderBarDblClick)); GetModel()->SetCompareHdl( LINK( this, SvSimpleTable, CompareHdl)); EnableCellFocus(); DisableTransientChildren(); - InitHeaderBar( &aHeaderBar ); + InitHeaderBar( aHeaderBar ); UpdateViewSize(); - aHeaderBar.Show(); + aHeaderBar->Show(); SvHeaderTabListBox::Show(); } SvSimpleTable::~SvSimpleTable() { + dispose(); +} + +void SvSimpleTable::dispose() +{ m_rParentTableContainer.SetTable(NULL); + aHeaderBar.disposeAndClear(); + SvHeaderTabListBox::dispose(); } void SvSimpleTable::UpdateViewSize() { Size theWinSize=m_rParentTableContainer.GetOutputSizePixel(); - Size HbSize=aHeaderBar.GetSizePixel(); + Size HbSize=aHeaderBar->GetSizePixel(); HbSize.Width()=theWinSize.Width(); theWinSize.Height()-=HbSize.Height(); Point thePos(0,0); - aHeaderBar.SetPosPixel(thePos); - aHeaderBar.SetSizePixel(HbSize); + aHeaderBar->SetPosPixel(thePos); + aHeaderBar->SetSizePixel(HbSize); thePos.Y()+=HbSize.Height(); SvHeaderTabListBox::SetPosPixel(thePos); @@ -138,9 +145,9 @@ void SvSimpleTable::NotifyScrolled() long nOffset=-GetXOffset(); if(nOldPos!=nOffset) { - aHeaderBar.SetOffset(nOffset); - aHeaderBar.Invalidate(); - aHeaderBar.Update(); + aHeaderBar->SetOffset(nOffset); + aHeaderBar->Invalidate(); + aHeaderBar->Update(); nOldPos=nOffset; } SvHeaderTabListBox::NotifyScrolled(); @@ -153,18 +160,18 @@ void SvSimpleTable::SetTabs() sal_uInt16 nPrivTabCount = TabCount(); if ( nPrivTabCount ) { - if ( nPrivTabCount > aHeaderBar.GetItemCount() ) - nPrivTabCount = aHeaderBar.GetItemCount(); + if ( nPrivTabCount > aHeaderBar->GetItemCount() ) + nPrivTabCount = aHeaderBar->GetItemCount(); sal_uInt16 i, nPos = 0; for ( i = 1; i < nPrivTabCount; ++i ) { sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos; - aHeaderBar.SetItemSize( i, nNewSize ); + aHeaderBar->SetItemSize( i, nNewSize ); nPos = (sal_uInt16)GetTab(i); } - aHeaderBar.SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry + aHeaderBar->SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry } } @@ -182,19 +189,19 @@ void SvSimpleTable::Paint( const Rectangle& rRect ) long nOffset=-GetXOffset(); nOldPos=nOffset; - aHeaderBar.SetOffset(nOffset); - aHeaderBar.Invalidate(); + aHeaderBar->SetOffset(nOffset); + aHeaderBar->Invalidate(); if(nPrivTabCount && bPaintFlag) { - if(nPrivTabCount>aHeaderBar.GetItemCount()) - nPrivTabCount=aHeaderBar.GetItemCount(); + if(nPrivTabCount>aHeaderBar->GetItemCount()) + nPrivTabCount=aHeaderBar->GetItemCount(); sal_uInt16 nPos = 0; for(sal_uInt16 i=1;i<nPrivTabCount;i++) { sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos; - aHeaderBar.SetItemSize( i, nNewSize ); + aHeaderBar->SetItemSize( i, nNewSize ); nPos= static_cast< sal_uInt16 >( GetTab(i) ); } } @@ -207,7 +214,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText, sal_Int32 nEnd = rText.indexOf( '\t' ); if( nEnd == -1 ) { - aHeaderBar.InsertItem(nHeaderItemId++, rText, 0, nBits, nCol); + aHeaderBar->InsertItem(nHeaderItemId++, rText, 0, nBits, nCol); } else { @@ -215,7 +222,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText, do { OUString aString = rText.getToken(0, '\t', nIndex); - aHeaderBar.InsertItem(nHeaderItemId++, aString, 0, nBits, nCol); + aHeaderBar->InsertItem(nHeaderItemId++, aString, 0, nBits, nCol); } while ( nIndex >= 0 ); } @@ -224,7 +231,7 @@ void SvSimpleTable::InsertHeaderEntry(const OUString& rText, void SvSimpleTable::ClearHeader() { - aHeaderBar.Clear(); + aHeaderBar->Clear(); } void SvSimpleTable::ShowTable() @@ -259,25 +266,25 @@ bool SvSimpleTable::IsEnabled() const sal_uInt16 SvSimpleTable::GetSelectedCol() { - return (aHeaderBar.GetCurItemId()-1); + return (aHeaderBar->GetCurItemId()-1); } void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir) { if(nSortCol!=0xFFFF) - aHeaderBar.SetItemBits(nSortCol+1,HIB_STDSTYLE); + aHeaderBar->SetItemBits(nSortCol+1,HIB_STDSTYLE); if (nCol != 0xFFFF) { if(bDir || nSortCol != nCol) { - aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_DOWNARROW); + aHeaderBar->SetItemBits( nCol+1, HIB_STDSTYLE | HIB_DOWNARROW); GetModel()->SetSortMode(SortAscending); bDir = true; } else { - aHeaderBar.SetItemBits( nCol+1, HIB_STDSTYLE | HIB_UPARROW); + aHeaderBar->SetItemBits( nCol+1, HIB_STDSTYLE | HIB_UPARROW); GetModel()->SetSortMode(SortDescending); } if(nSortCol == nCol) @@ -300,9 +307,9 @@ void SvSimpleTable::SortByCol(sal_uInt16 nCol, bool bDir) void SvSimpleTable::HBarClick() { - sal_uInt16 nId=aHeaderBar.GetCurItemId(); + sal_uInt16 nId=aHeaderBar->GetCurItemId(); - if (aHeaderBar.GetItemBits(nId) & HIB_CLICKABLE) + if (aHeaderBar->GetItemBits(nId) & HIB_CLICKABLE) { if(nId==nSortCol+1) { @@ -324,24 +331,24 @@ void SvSimpleTable::HBarDblClick() void SvSimpleTable::HBarStartDrag() { - if(!aHeaderBar.IsItemMode()) + if(!aHeaderBar->IsItemMode()) { Rectangle aSizeRect(Point(0,0), SvHeaderTabListBox::GetOutputSizePixel()); - aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos(); - aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos(); + aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos(); + aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos(); ShowTracking( aSizeRect, SHOWTRACK_SPLIT ); } } void SvSimpleTable::HBarDrag() { HideTracking(); - if(!aHeaderBar.IsItemMode()) + if(!aHeaderBar->IsItemMode()) { Rectangle aSizeRect(Point(0,0), SvHeaderTabListBox::GetOutputSizePixel()); - aSizeRect.Left()=-GetXOffset()+aHeaderBar.GetDragPos(); - aSizeRect.Right()=-GetXOffset()+aHeaderBar.GetDragPos(); + aSizeRect.Left()=-GetXOffset()+aHeaderBar->GetDragPos(); + aSizeRect.Right()=-GetXOffset()+aHeaderBar->GetDragPos(); ShowTracking( aSizeRect, SHOWTRACK_SPLIT ); } } @@ -352,14 +359,14 @@ void SvSimpleTable::HBarEndDrag() if(nPrivTabCount) { - if(nPrivTabCount>aHeaderBar.GetItemCount()) - nPrivTabCount=aHeaderBar.GetItemCount(); + if(nPrivTabCount>aHeaderBar->GetItemCount()) + nPrivTabCount=aHeaderBar->GetItemCount(); sal_uInt16 nPos=0; sal_uInt16 nNewSize=0; for(sal_uInt16 i=1;i<nPrivTabCount;i++) { - nNewSize = static_cast< sal_uInt16 >( aHeaderBar.GetItemSize(i) ) + nPos; + nNewSize = static_cast< sal_uInt16 >( aHeaderBar->GetItemSize(i) ) + nPos; SetTab( i, nNewSize, MAP_PIXEL ); nPos = nNewSize; } @@ -379,7 +386,7 @@ void SvSimpleTable::Command( const CommandEvent& rCEvt ) IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr) { - if(pCtr==&aHeaderBar) + if(pCtr==aHeaderBar.get()) { HBarStartDrag(); } @@ -388,7 +395,7 @@ IMPL_LINK( SvSimpleTable, StartDragHdl, HeaderBar*, pCtr) IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr) { - if(pCtr==&aHeaderBar) + if(pCtr==aHeaderBar.get()) { HBarDrag(); } @@ -397,7 +404,7 @@ IMPL_LINK( SvSimpleTable, DragHdl, HeaderBar*, pCtr) IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr) { - if(pCtr==&aHeaderBar) + if(pCtr==aHeaderBar.get()) { HBarEndDrag(); } @@ -406,7 +413,7 @@ IMPL_LINK( SvSimpleTable, EndDragHdl, HeaderBar*, pCtr) IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr) { - if(pCtr==&aHeaderBar) + if(pCtr==aHeaderBar.get()) { HBarClick(); } @@ -415,7 +422,7 @@ IMPL_LINK( SvSimpleTable, HeaderBarClick, HeaderBar*, pCtr) IMPL_LINK( SvSimpleTable, HeaderBarDblClick, HeaderBar*, pCtr) { - if(pCtr==&aHeaderBar) + if(pCtr==aHeaderBar.get()) { HBarDblClick(); } diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 39eb1dc3ac88..fe38597196d3 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -47,9 +47,9 @@ Image* SvImpLBox::s_pDefExpanded = NULL; sal_Int32 SvImpLBox::s_nImageRefCount = 0; SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinStyle) - : aVerSBar(pLBView, WB_DRAG | WB_VSCROLL) - , aHorSBar(pLBView, WB_DRAG | WB_HSCROLL) - , aScrBarBox(pLBView) + : aVerSBar(new ScrollBar(pLBView, WB_DRAG | WB_VSCROLL)) + , aHorSBar(new ScrollBar(pLBView, WB_DRAG | WB_HSCROLL)) + , aScrBarBox(new ScrollBarBox(pLBView)) , aOutputSize(0, 0) , aSelEng(pLBView, (FunctionSet*)0) , aFctSet(this, &aSelEng, pLBView) @@ -67,18 +67,18 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS SetSelectionMode( SINGLE_SELECTION ); SetDragDropMode( 0 ); - aVerSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) ); - aHorSBar.SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) ); - aHorSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) ); - aVerSBar.SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) ); - aVerSBar.SetRange( Range(0,0) ); - aVerSBar.Hide(); - aHorSBar.SetRange( Range(0,0) ); - aHorSBar.SetPageSize( 24 ); // pixels - aHorSBar.SetLineSize( 8 ); // pixels + aVerSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollUpDownHdl ) ); + aHorSBar->SetScrollHdl( LINK( this, SvImpLBox, ScrollLeftRightHdl ) ); + aHorSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) ); + aVerSBar->SetEndScrollHdl( LINK( this, SvImpLBox, EndScrollHdl ) ); + aVerSBar->SetRange( Range(0,0) ); + aVerSBar->Hide(); + aHorSBar->SetRange( Range(0,0) ); + aHorSBar->SetPageSize( 24 ); // pixels + aHorSBar->SetLineSize( 8 ); // pixels - nHorSBarHeight = (short)aHorSBar.GetSizePixel().Height(); - nVerSBarWidth = (short)aVerSBar.GetSizePixel().Width(); + nHorSBarHeight = (short)aHorSBar->GetSizePixel().Height(); + nVerSBarWidth = (short)aVerSBar->GetSizePixel().Width(); pStartEntry = 0; pCursor = 0; @@ -124,6 +124,9 @@ SvImpLBox::~SvImpLBox() DELETEZ(s_pDefCollapsed); DELETEZ(s_pDefExpanded); } + aVerSBar.disposeAndClear(); + aHorSBar.disposeAndClear(); + aScrBarBox.disposeAndClear(); } void SvImpLBox::UpdateStringSorter() @@ -268,25 +271,25 @@ void SvImpLBox::Clear() pView->HideFocus(); pCursor = 0; } - aVerSBar.Hide(); - aVerSBar.SetThumbPos( 0 ); + aVerSBar->Hide(); + aVerSBar->SetThumbPos( 0 ); Range aRange( 0, 0 ); - aVerSBar.SetRange( aRange ); + aVerSBar->SetRange( aRange ); aOutputSize = pView->Control::GetOutputSizePixel(); nFlags &= ~(F_VER_SBARSIZE_WITH_HBAR | F_HOR_SBARSIZE_WITH_VBAR ); - aHorSBar.Hide(); - aHorSBar.SetThumbPos( 0 ); + aHorSBar->Hide(); + aHorSBar->SetThumbPos( 0 ); MapMode aMapMode( pView->GetMapMode()); aMapMode.SetOrigin( Point(0,0) ); pView->Control::SetMapMode( aMapMode ); - aHorSBar.SetRange( aRange ); - aHorSBar.SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight)); + aHorSBar->SetRange( aRange ); + aHorSBar->SetSizePixel(Size(aOutputSize.Width(),nHorSBarHeight)); pView->SetClipRegion(); if( GetUpdateMode() ) pView->Invalidate( GetVisibleArea() ); nFlags |= F_FILLING; - if( !aHorSBar.IsVisible() && !aVerSBar.IsVisible() ) - aScrBarBox.Hide(); + if( !aHorSBar->IsVisible() && !aVerSBar->IsVisible() ) + aScrBarBox->Hide(); aContextBmpWidthVector.clear(); @@ -301,7 +304,7 @@ IMPL_LINK_NOARG_INLINE_START(SvImpLBox, EndScrollHdl) { if( nFlags & F_ENDSCROLL_SET_VIS_SIZE ) { - aVerSBar.SetVisibleSize( nNextVerVisSize ); + aVerSBar->SetVisibleSize( nNextVerVisSize ); nFlags &= ~F_ENDSCROLL_SET_VIS_SIZE; } EndScroll(); @@ -470,16 +473,16 @@ void SvImpLBox::PageUp( sal_uInt16 nDelta ) void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll ) { - if( !aVerSBar.IsVisible() ) + if( !aVerSBar->IsVisible() ) return; long nDelta; if( bPageUp ) - nDelta = aVerSBar.GetPageSize(); + nDelta = aVerSBar->GetPageSize(); else nDelta = 1; - long nThumbPos = aVerSBar.GetThumbPos(); + long nThumbPos = aVerSBar->GetThumbPos(); if( nThumbPos < nDelta ) nDelta = nThumbPos; @@ -491,7 +494,7 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll ) if( bNotifyScroll ) BeginScroll(); - aVerSBar.SetThumbPos( nThumbPos - nDelta ); + aVerSBar->SetThumbPos( nThumbPos - nDelta ); if( bPageUp ) PageUp( (short)nDelta ); else @@ -504,18 +507,18 @@ void SvImpLBox::KeyUp( bool bPageUp, bool bNotifyScroll ) void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll ) { - if( !aVerSBar.IsVisible() ) + if( !aVerSBar->IsVisible() ) return; long nDelta; if( bPageDown ) - nDelta = aVerSBar.GetPageSize(); + nDelta = aVerSBar->GetPageSize(); else nDelta = 1; - long nThumbPos = aVerSBar.GetThumbPos(); - long nVisibleSize = aVerSBar.GetVisibleSize(); - long nRange = aVerSBar.GetRange().Len(); + long nThumbPos = aVerSBar->GetThumbPos(); + long nVisibleSize = aVerSBar->GetVisibleSize(); + long nRange = aVerSBar->GetRange().Len(); long nTmp = nThumbPos+nVisibleSize; while( (nDelta > 0) && (nTmp+nDelta) >= nRange ) @@ -528,7 +531,7 @@ void SvImpLBox::KeyDown( bool bPageDown, bool bNotifyScroll ) if( bNotifyScroll ) BeginScroll(); - aVerSBar.SetThumbPos( nThumbPos+nDelta ); + aVerSBar->SetThumbPos( nThumbPos+nDelta ); if( bPageDown ) PageDown( (short)nDelta ); else @@ -709,7 +712,7 @@ void SvImpLBox::UpdateAll( { if( bUpdateVerScrollBar ) FindMostRight(0); - aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) ); + aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) ); SyncVerThumb(); FillView(); ShowVerSBar(); @@ -748,7 +751,7 @@ void SvImpLBox::KeyLeftRight( long nDelta ) ShowCursor( false ); // neuen Origin berechnen - long nPos = aHorSBar.GetThumbPos(); + long nPos = aHorSBar->GetThumbPos(); Point aOrigin( -nPos, 0 ); MapMode aMapMode( pView->GetMapMode() ); @@ -899,7 +902,7 @@ void SvImpLBox::Paint( const Rectangle& rRect ) { ShowCursor( false ); pStartEntry = pView->First(); - aVerSBar.SetThumbPos( 0 ); + aVerSBar->SetThumbPos( 0 ); StopUserEvent(); ShowCursor( true ); nCurUserEvent = Application::PostUserEvent(LINK(this,SvImpLBox,MyUserEvent), reinterpret_cast<void*>(1)); @@ -1003,7 +1006,7 @@ void SvImpLBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop ) pStartEntry = pEntry; ShowCursor( false ); FillView(); - aVerSBar.SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) ); + aVerSBar->SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) ); ShowCursor( true ); pView->Invalidate(); } @@ -1030,7 +1033,7 @@ void SvImpLBox::ScrollToAbsPos( long nPos ) { pStartEntry = pEntry; ShowCursor( false ); - aVerSBar.SetThumbPos( nPos ); + aVerSBar->SetThumbPos( nPos ); ShowCursor( true ); if (GetUpdateMode()) pView->Invalidate(); @@ -1168,12 +1171,12 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask ) aVerSize.Height() += 2 * nOverlap; Point aVerPos( rSize.Width() - aVerSize.Width() + nOverlap, -nOverlap ); - aVerSBar.SetPosSizePixel( aVerPos, aVerSize ); + aVerSBar->SetPosSizePixel( aVerPos, aVerSize ); aHorSize.Width() += 2 * nOverlap; Point aHorPos( -nOverlap, rSize.Height() - aHorSize.Height() + nOverlap ); - aHorSBar.SetPosSizePixel( aHorPos, aHorSize ); + aHorSBar->SetPosSizePixel( aHorPos, aHorSize ); if( nMask & 0x0001 ) rSize.Width() = aVerPos.X(); @@ -1181,9 +1184,9 @@ void SvImpLBox::PositionScrollBars( Size& rSize, sal_uInt16 nMask ) rSize.Height() = aHorPos.Y(); if( (nMask & (0x0001|0x0002)) == (0x0001|0x0002) ) - aScrBarBox.Show(); + aScrBarBox->Show(); else - aScrBarBox.Hide(); + aScrBarBox->Hide(); } // nResult: Bit0 == VerSBar Bit1 == HorSBar @@ -1259,12 +1262,12 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize ) // vertical scrollbar long nTemp = (long)nVisibleCount; nTemp--; - if( nTemp != aVerSBar.GetVisibleSize() ) + if( nTemp != aVerSBar->GetVisibleSize() ) { if( !bInVScrollHdl ) { - aVerSBar.SetPageSize( nTemp - 1 ); - aVerSBar.SetVisibleSize( nTemp ); + aVerSBar->SetPageSize( nTemp - 1 ); + aVerSBar->SetVisibleSize( nTemp ); } else { @@ -1274,14 +1277,14 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize ) } // horizontal scrollbar - nTemp = aHorSBar.GetThumbPos(); - aHorSBar.SetVisibleSize( aOSize.Width() ); - long nNewThumbPos = aHorSBar.GetThumbPos(); - Range aRange( aHorSBar.GetRange() ); + nTemp = aHorSBar->GetThumbPos(); + aHorSBar->SetVisibleSize( aOSize.Width() ); + long nNewThumbPos = aHorSBar->GetThumbPos(); + Range aRange( aHorSBar->GetRange() ); if( aRange.Max() < nMostRight+25 ) { aRange.Max() = nMostRight+25; - aHorSBar.SetRange( aRange ); + aHorSBar->SetRange( aRange ); } if( nTemp != nNewThumbPos ) @@ -1297,15 +1300,15 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize ) } if( nResult & 0x0001 ) - aVerSBar.Show(); + aVerSBar->Show(); else - aVerSBar.Hide(); + aVerSBar->Hide(); if( nResult & 0x0002 ) - aHorSBar.Show(); + aHorSBar->Show(); else { - aHorSBar.Hide(); + aHorSBar->Hide(); } rSize = aOSize; return nResult; @@ -1313,9 +1316,9 @@ sal_uInt16 SvImpLBox::AdjustScrollBars( Size& rSize ) void SvImpLBox::InitScrollBarBox() { - aScrBarBox.SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) ); + aScrBarBox->SetSizePixel( Size(nVerSBarWidth, nHorSBarHeight) ); Size aSize( pView->Control::GetOutputSizePixel() ); - aScrBarBox.SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight)); + aScrBarBox->SetPosPixel( Point(aSize.Width()-nVerSBarWidth, aSize.Height()-nHorSBarHeight)); } void SvImpLBox::Resize() @@ -1333,10 +1336,10 @@ void SvImpLBox::Resize() } // HACK, as in floating and docked windows the scrollbars might not be drawn // correctly/not be drawn at all after resizing! - if( aHorSBar.IsVisible()) - aHorSBar.Invalidate(); - if( aVerSBar.IsVisible()) - aVerSBar.Invalidate(); + if( aHorSBar->IsVisible()) + aHorSBar->Invalidate(); + if( aVerSBar->IsVisible()) + aVerSBar->Invalidate(); nFlags &= (~(F_IN_RESIZE | F_PAINTED)); } @@ -1345,7 +1348,7 @@ void SvImpLBox::FillView() if( !pStartEntry ) { sal_uInt16 nVisibleViewCount = (sal_uInt16)(pView->GetVisibleCount()); - sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar.GetThumbPos(); + sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar->GetThumbPos(); if( nTempThumb >= nVisibleViewCount ) nTempThumb = nVisibleViewCount - 1; pStartEntry = pView->GetEntryAtVisPos(nTempThumb); @@ -1374,7 +1377,7 @@ void SvImpLBox::FillView() } if( bFound ) { - aVerSBar.SetThumbPos( nThumb ); + aVerSBar->SetThumbPos( nThumb ); ShowCursor( true ); // recalculate focus rectangle pView->Invalidate(); } @@ -1393,17 +1396,17 @@ void SvImpLBox::ShowVerSBar() nVis = pView->GetVisibleCount(); if( bVerBar || (nVisibleCount && nVis > (sal_uLong)(nVisibleCount-1)) ) { - if( !aVerSBar.IsVisible() ) + if( !aVerSBar->IsVisible() ) { pView->nFocusWidth = -1; AdjustScrollBars( aOutputSize ); if( GetUpdateMode() ) - aVerSBar.Update(); + aVerSBar->Update(); } } else { - if( aVerSBar.IsVisible() ) + if( aVerSBar->IsVisible() ) { pView->nFocusWidth = -1; AdjustScrollBars( aOutputSize ); @@ -1416,20 +1419,20 @@ void SvImpLBox::ShowVerSBar() nMaxRight = nMaxRight + aPos.X() - 1; if( nMaxRight < nMostRight ) { - if( !aHorSBar.IsVisible() ) + if( !aHorSBar->IsVisible() ) { pView->nFocusWidth = -1; AdjustScrollBars( aOutputSize ); if( GetUpdateMode() ) - aHorSBar.Update(); + aHorSBar->Update(); } else { - Range aRange( aHorSBar.GetRange() ); + Range aRange( aHorSBar->GetRange() ); if( aRange.Max() < nMostRight+25 ) { aRange.Max() = nMostRight+25; - aHorSBar.SetRange( aRange ); + aHorSBar->SetRange( aRange ); } else { @@ -1440,7 +1443,7 @@ void SvImpLBox::ShowVerSBar() } else { - if( aHorSBar.IsVisible() ) + if( aHorSBar->IsVisible() ) { pView->nFocusWidth = -1; AdjustScrollBars( aOutputSize ); @@ -1454,10 +1457,10 @@ void SvImpLBox::SyncVerThumb() if( pStartEntry ) { long nEntryPos = pView->GetVisiblePos( pStartEntry ); - aVerSBar.SetThumbPos( nEntryPos ); + aVerSBar->SetThumbPos( nEntryPos ); } else - aVerSBar.SetThumbPos( 0 ); + aVerSBar->SetThumbPos( 0 ); } bool SvImpLBox::IsEntryInView( SvTreeListEntry* pEntry ) const @@ -1522,7 +1525,7 @@ void SvImpLBox::EntryExpanded( SvTreeListEntry* pEntry ) InvalidateEntriesFrom( nY ); FindMostRight( pEntry, 0 ); } - aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) ); + aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) ); // if we expanded before the thumb, the thumb's position has to be // corrected SyncVerThumb(); @@ -1545,10 +1548,10 @@ void SvImpLBox::EntryCollapsed( SvTreeListEntry* pEntry ) if( pStartEntry ) { - long nOldThumbPos = aVerSBar.GetThumbPos(); + long nOldThumbPos = aVerSBar->GetThumbPos(); sal_uLong nVisList = pView->GetVisibleCount(); - aVerSBar.SetRange( Range(0, nVisList-1) ); - long nNewThumbPos = aVerSBar.GetThumbPos(); + aVerSBar->SetRange( Range(0, nVisList-1) ); + long nNewThumbPos = aVerSBar->GetThumbPos(); if( nNewThumbPos != nOldThumbPos ) { pStartEntry = pView->First(); @@ -1708,7 +1711,7 @@ void SvImpLBox::RemovingEntry( SvTreeListEntry* pEntry ) // drawn correctly (in this case they're deleted) if( pStartEntry && (pStartEntry != pOldStartEntry || pEntry == (SvTreeListEntry*)pView->GetModel()->Last()) ) { - aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry )); + aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry )); pView->Invalidate( GetVisibleArea() ); } else @@ -1735,11 +1738,11 @@ void SvImpLBox::EntryRemoved() { if( nFlags & F_REMOVED_RECALC_MOST_RIGHT ) FindMostRight(0); - aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1 ) ); + aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1 ) ); FillView(); if( pStartEntry ) // if something above the thumb was deleted - aVerSBar.SetThumbPos( pView->GetVisiblePos( pStartEntry) ); + aVerSBar->SetThumbPos( pView->GetVisiblePos( pStartEntry) ); ShowVerSBar(); if( pCursor && pView->HasFocus() && !pView->IsSelected(pCursor) ) @@ -1804,7 +1807,7 @@ void SvImpLBox::EntryMoved( SvTreeListEntry* pEntry ) // #i97346# pStartEntry = pView->First(); - aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1)); + aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1)); sal_uInt16 nFirstPos = (sal_uInt16)pTree->GetAbsPos( pStartEntry ); sal_uInt16 nNewPos = (sal_uInt16)pTree->GetAbsPos( pEntry ); FindMostRight(0); @@ -1876,7 +1879,7 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry ) pView->Invalidate(); SetMostRight( pEntry ); - aVerSBar.SetRange( Range(0, pView->GetVisibleCount()-1)); + aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1)); SyncVerThumb(); // if something was inserted before the thumb ShowVerSBar(); ShowCursor( true ); @@ -2153,7 +2156,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) bool bKeyUsed = true; - sal_uInt16 nDelta = (sal_uInt16)aVerSBar.GetPageSize(); + sal_uInt16 nDelta = (sal_uInt16)aVerSBar->GetPageSize(); sal_uInt16 aCode = rKeyCode.GetCode(); bool bShift = rKeyCode.IsShift(); @@ -2251,12 +2254,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) } else if( nWindowStyle & WB_HSCROLL ) { - long nThumb = aHorSBar.GetThumbPos(); - nThumb += aHorSBar.GetLineSize(); - long nOldThumb = aHorSBar.GetThumbPos(); - aHorSBar.SetThumbPos( nThumb ); + long nThumb = aHorSBar->GetThumbPos(); + nThumb += aHorSBar->GetLineSize(); + long nOldThumb = aHorSBar->GetThumbPos(); + aHorSBar->SetThumbPos( nThumb ); nThumb = nOldThumb; - nThumb -= aHorSBar.GetThumbPos(); + nThumb -= aHorSBar->GetThumbPos(); nThumb *= -1; if( nThumb ) { @@ -2282,12 +2285,12 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) } else if ( nWindowStyle & WB_HSCROLL ) { - long nThumb = aHorSBar.GetThumbPos(); - nThumb -= aHorSBar.GetLineSize(); - long nOldThumb = aHorSBar.GetThumbPos(); - aHorSBar.SetThumbPos( nThumb ); + long nThumb = aHorSBar->GetThumbPos(); + nThumb -= aHorSBar->GetLineSize(); + long nOldThumb = aHorSBar->GetThumbPos(); + aHorSBar->SetThumbPos( nThumb ); nThumb = nOldThumb; - nThumb -= aHorSBar.GetThumbPos(); + nThumb -= aHorSBar->GetThumbPos(); if( nThumb ) { KeyLeftRight( -nThumb ); @@ -2979,7 +2982,7 @@ void SvImpLBox::Command( const CommandEvent& rCEvt ) // scroll mouse event? if( ( ( nCommand == COMMAND_WHEEL ) || ( nCommand == COMMAND_STARTAUTOSCROLL ) || ( nCommand == COMMAND_AUTOSCROLL ) ) - && pView->HandleScrollCommand( rCEvt, &aHorSBar, &aVerSBar ) ) + && pView->HandleScrollCommand( rCEvt, aHorSBar.get(), aVerSBar.get() ) ) return; if( bContextMenuHandling && nCommand == COMMAND_CONTEXTMENU ) diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index b078a9c559a2..a48a8cbbcf50 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -110,12 +110,18 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvTabListBox(vcl::Wind SvTabListBox::~SvTabListBox() { + dispose(); +} + +void SvTabListBox::dispose() +{ // delete array delete [] pTabList; #ifdef DBG_UTIL pTabList = 0; nTabCount = 0; #endif + SvTreeListBox::dispose(); } void SvTabListBox::SetTabs(const long* pTabs, MapUnit eMapUnit) @@ -520,7 +526,13 @@ SvHeaderTabListBox::SvHeaderTabListBox( vcl::Window* pParent, WinBits nWinStyle SvHeaderTabListBox::~SvHeaderTabListBox() { + dispose(); +} + +void SvHeaderTabListBox::dispose() +{ delete m_pImpl; + SvTabListBox::dispose(); } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 447b9f87d72c..b50e746081ac 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1541,6 +1541,11 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) SvTreeListBox::~SvTreeListBox() { + dispose(); +} + +void SvTreeListBox::dispose() +{ pImp->CallEventListeners( VCLEVENT_OBJECT_DYING ); delete pImp; @@ -1564,6 +1569,7 @@ SvTreeListBox::~SvTreeListBox() if( this == pDDTarget ) pDDTarget = 0; delete mpImpl; + Control::dispose(); } void SvTreeListBox::SetExtendedWinBits( ExtendedWinBits _nBits ) @@ -2236,17 +2242,17 @@ void SvTreeListBox::ShowTargetEmphasis( SvTreeListEntry* pEntry, bool /*bShow*/ void SvTreeListBox::ScrollOutputArea( short nDeltaEntries ) { - if( !nDeltaEntries || !pImp->aVerSBar.IsVisible() ) + if( !nDeltaEntries || !pImp->aVerSBar->IsVisible() ) return; - long nThumb = pImp->aVerSBar.GetThumbPos(); - long nMax = pImp->aVerSBar.GetRange().Max(); + long nThumb = pImp->aVerSBar->GetThumbPos(); + long nMax = pImp->aVerSBar->GetRange().Max(); if( nDeltaEntries < 0 ) { // move window up nDeltaEntries *= -1; - long nVis = pImp->aVerSBar.GetVisibleSize(); + long nVis = pImp->aVerSBar->GetVisibleSize(); long nTemp = nThumb + nVis; if( nDeltaEntries > (nMax - nTemp) ) nDeltaEntries = (short)(nMax - nTemp); @@ -3666,12 +3672,12 @@ void SvTreeListBox::EndSelection() ScrollBar *SvTreeListBox::GetVScroll() { - return &((SvTreeListBox*)this)->pImp->aVerSBar; + return pImp->aVerSBar.get(); } ScrollBar *SvTreeListBox::GetHScroll() { - return &((SvTreeListBox*)this)->pImp->aHorSBar; + return pImp->aHorSBar.get(); } void SvTreeListBox::EnableAsyncDrag( bool b ) diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 1d02dc34ab09..a0d1c0682bb6 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -257,6 +257,11 @@ Calendar::Calendar( vcl::Window* pParent, WinBits nWinStyle ) : Calendar::~Calendar() { + dispose(); +} + +void Calendar::dispose() +{ delete mpStandardColor; delete mpSaturdayColor; delete mpSundayColor; @@ -264,6 +269,7 @@ Calendar::~Calendar() delete mpSelectTable; delete mpOldSelectTable; delete mpRestoreSelectTable; + Control::dispose(); } @@ -2190,7 +2196,8 @@ private: public: ImplCFieldFloatWin( vcl::Window* pParent ); - virtual ~ImplCFieldFloatWin(); + virtual ~ImplCFieldFloatWin(); + virtual void dispose() SAL_OVERRIDE; void SetCalendar( Calendar* pCalendar ) { mpCalendar = pCalendar; } @@ -2217,9 +2224,15 @@ ImplCFieldFloatWin::ImplCFieldFloatWin( vcl::Window* pParent ) : ImplCFieldFloatWin::~ImplCFieldFloatWin() { + dispose(); +} + +void ImplCFieldFloatWin::dispose() +{ delete mpTodayBtn; delete mpNoneBtn; delete mpFixedLine; + FloatingWindow::dispose(); } @@ -2381,11 +2394,17 @@ CalendarField::CalendarField(vcl::Window* pParent, WinBits nWinStyle) CalendarField::~CalendarField() { + dispose(); +} + +void CalendarField::dispose() +{ if ( mpFloatWin ) { delete mpCalendar; delete mpFloatWin; } + DateField::dispose(); } diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index f0767ff83d87..2bac5a8a3567 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -118,8 +118,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeColorListBox(vcl::Wind ColorListBox::~ColorListBox() { + dispose(); +} + +void ColorListBox::dispose() +{ ImplDestroyColorEntries(); delete pColorList; + ListBox::dispose(); } sal_Int32 ColorListBox::InsertEntry( const OUString& rStr, sal_Int32 nPos ) @@ -739,6 +745,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeLineListBox(vcl::Windo LineListBox::~LineListBox() { + dispose(); +} + +void LineListBox::dispose() +{ for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) { if ( (*pLineList)[ i ] ) { delete (*pLineList)[ i ]; @@ -746,6 +757,7 @@ LineListBox::~LineListBox() } pLineList->clear(); delete pLineList; + ListBox::dispose(); } sal_Int32 LineListBox::GetStylePos( sal_Int32 nListPos, long nWidth ) @@ -936,8 +948,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontNameBox(vcl::Windo FontNameBox::~FontNameBox() { + dispose(); +} + +void FontNameBox::dispose() +{ SaveMRUEntries (maFontMRUEntriesFile); ImplDestroyFontList(); + ComboBox::dispose(); } void FontNameBox::SaveMRUEntries( const OUString& aFontMRUEntriesFile, sal_Unicode cSep ) const @@ -1312,10 +1330,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontStyleBox(vcl::Wind return pListBox; } -FontStyleBox::~FontStyleBox() -{ -} - void FontStyleBox::Select() { // keep text over fill operation @@ -1512,10 +1526,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFontSizeBox(vcl::Windo return pListBox; } -FontSizeBox::~FontSizeBox() -{ -} - void FontSizeBox::ImplInit() { EnableAutocomplete( false ); diff --git a/svtools/source/control/filectrl.cxx b/svtools/source/control/filectrl.cxx index 5f938cb002b2..14512372092b 100644 --- a/svtools/source/control/filectrl.cxx +++ b/svtools/source/control/filectrl.cxx @@ -36,17 +36,17 @@ using namespace ::com::sun::star::ui; FileControl::FileControl( vcl::Window* pParent, WinBits nStyle, FileControlMode nFlags ) : Window( pParent, nStyle|WB_DIALOGCONTROL ), - maEdit( this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP ), - maButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ), + maEdit( new Edit(this, (nStyle&(~WB_BORDER))|WB_NOTABSTOP) ), + maButton( new PushButton( this, (nStyle&(~WB_BORDER))|WB_NOLIGHTBORDER|WB_NOPOINTERFOCUS|WB_NOTABSTOP ) ), maButtonText( SVT_RESSTR(STR_FILECTRL_BUTTONTEXT) ), mnFlags( nFlags ), mnInternalFlags( FILECTRL_ORIGINALBUTTONTEXT ) { - maButton.SetClickHdl( LINK( this, FileControl, ButtonHdl ) ); + maButton->SetClickHdl( LINK( this, FileControl, ButtonHdl ) ); mbOpenDlg = true; - maButton.Show(); - maEdit.Show(); + maButton->Show(); + maEdit->Show(); SetCompoundControl( true ); @@ -59,17 +59,17 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle ) { if ( !( nStyle & WB_NOTABSTOP ) ) { - maEdit.SetStyle( (maEdit.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) ); - maButton.SetStyle( (maButton.GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) ); + maEdit->SetStyle( (maEdit->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) ); + maButton->SetStyle( (maButton->GetStyle()|WB_TABSTOP)&(~WB_NOTABSTOP) ); } else { - maEdit.SetStyle( (maEdit.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) ); - maButton.SetStyle( (maButton.GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) ); + maEdit->SetStyle( (maEdit->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) ); + maButton->SetStyle( (maButton->GetStyle()|WB_NOTABSTOP)&(~WB_TABSTOP) ); } const WinBits nAlignmentStyle = ( WB_TOP | WB_VCENTER | WB_BOTTOM ); - maEdit.SetStyle( ( maEdit.GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) ); + maEdit->SetStyle( ( maEdit->GetStyle() & ~nAlignmentStyle ) | ( nStyle & nAlignmentStyle ) ); if ( !(nStyle & WB_NOGROUP) ) nStyle |= WB_GROUP; @@ -86,13 +86,19 @@ WinBits FileControl::ImplInitStyle( WinBits nStyle ) FileControl::~FileControl() { + dispose(); } - +void FileControl::dispose() +{ + maEdit.disposeAndClear(); + maButton.disposeAndClear(); + Window::dispose(); +} void FileControl::SetText( const OUString& rStr ) { - maEdit.SetText( rStr ); + maEdit->SetText( rStr ); if ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN ) Resize(); } @@ -101,7 +107,7 @@ void FileControl::SetText( const OUString& rStr ) OUString FileControl::GetText() const { - return maEdit.GetText(); + return maEdit->GetText(); } @@ -110,8 +116,8 @@ void FileControl::StateChanged( StateChangedType nType ) { if ( nType == StateChangedType::ENABLE ) { - maEdit.Enable( IsEnabled() ); - maButton.Enable( IsEnabled() ); + maEdit->Enable( IsEnabled() ); + maButton->Enable( IsEnabled() ); } else if ( nType == StateChangedType::ZOOM ) { @@ -155,27 +161,27 @@ void FileControl::Resize() mnInternalFlags |= FILECTRL_INRESIZE;//InResize = sal_True Size aOutSz = GetOutputSizePixel(); - long nButtonTextWidth = maButton.GetTextWidth( maButtonText ); + long nButtonTextWidth = maButton->GetTextWidth( maButtonText ); if ( ((mnInternalFlags & FILECTRL_ORIGINALBUTTONTEXT) == 0) || ( nButtonTextWidth < aOutSz.Width()/3 && ( mnFlags & FILECTRL_RESIZEBUTTONBYPATHLEN - ? ( maEdit.GetTextWidth( maEdit.GetText() ) + ? ( maEdit->GetTextWidth( maEdit->GetText() ) <= aOutSz.Width() - nButtonTextWidth - ButtonBorder ) : sal_True ) ) ) { - maButton.SetText( maButtonText ); + maButton->SetText( maButtonText ); } else { OUString aSmallText( "..." ); - maButton.SetText( aSmallText ); - nButtonTextWidth = maButton.GetTextWidth( aSmallText ); + maButton->SetText( aSmallText ); + nButtonTextWidth = maButton->GetTextWidth( aSmallText ); } long nButtonWidth = nButtonTextWidth+ButtonBorder; - maEdit.setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() ); - maButton.setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() ); + maEdit->setPosSizePixel( 0, 0, aOutSz.Width()-nButtonWidth, aOutSz.Height() ); + maButton->setPosSizePixel( aOutSz.Width()-nButtonWidth, 0, nButtonWidth, aOutSz.Height() ); mnInternalFlags &= ~FILECTRL_INRESIZE; //InResize = sal_False } @@ -193,7 +199,7 @@ IMPL_LINK_NOARG(FileControl, ButtonHdl) void FileControl::GetFocus() { - maEdit.GrabFocus(); + maEdit->GrabFocus(); } @@ -239,7 +245,7 @@ void FileControl::ImplBrowseFile( ) if ( aObj.GetProtocol() == INetProtocol::File ) aNewText = aObj.PathToFileName(); SetText( aNewText ); - maEdit.GetModifyHdl().Call( &maEdit ); + maEdit->GetModifyHdl().Call( &maEdit ); } } } diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index d021fc900ca6..656436e533b5 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -334,10 +334,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeFormattedField(vcl::Wi return new FormattedField(pParent, nWinBits); } -FormattedField::~FormattedField() -{ -} - void FormattedField::SetText(const OUString& rStr) { @@ -1026,7 +1022,13 @@ void FormattedField::UseInputStringForFormatting( bool bUseInputStr /* = true */ DoubleNumericField::~DoubleNumericField() { + dispose(); +} + +void DoubleNumericField::dispose() +{ delete m_pNumberValidator; + FormattedField::dispose(); } void DoubleNumericField::FormatChanged(FORMAT_CHANGE_TYPE nWhat) diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 1f58281bcc45..be8b57493f8d 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -114,12 +114,18 @@ HeaderBar::HeaderBar( vcl::Window* pParent, WinBits nWinStyle ) : HeaderBar::~HeaderBar() { + dispose(); +} + +void HeaderBar::dispose() +{ // Alle Items loeschen for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) { delete (*mpItemList)[ i ]; } mpItemList->clear(); delete mpItemList; + Window::dispose(); } diff --git a/svtools/source/control/hyperlabel.cxx b/svtools/source/control/hyperlabel.cxx index e54d7e1bdddf..2929bccc96b3 100644 --- a/svtools/source/control/hyperlabel.cxx +++ b/svtools/source/control/hyperlabel.cxx @@ -155,7 +155,13 @@ namespace svt HyperLabel::~HyperLabel( ) { + dispose(); + } + + void HyperLabel::dispose() + { delete m_pImpl; + FixedText::dispose(); } void HyperLabel::SetInteractive( bool _bInteractive ) diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index f75c82c98d9a..826038018245 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -906,6 +906,11 @@ void SvtURLBox::Init(bool bSetDefaultHelpID) SvtURLBox::~SvtURLBox() { + dispose(); +} + +void SvtURLBox::dispose() +{ if( pCtx.is() ) { pCtx->Stop(); @@ -913,6 +918,7 @@ SvtURLBox::~SvtURLBox() } delete pImp; + ComboBox::dispose(); } void SvtURLBox::UpdatePickList( ) diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index dcd6d6b497c6..9e40446eb02f 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -45,7 +45,6 @@ namespace svt { public: IDLabel( vcl::Window* _pParent, WinBits _nWinStyle = 0 ); - virtual ~IDLabel( ); virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; }; @@ -204,6 +203,11 @@ namespace svt ORoadmap::~ORoadmap( ) { + dispose(); + } + + void ORoadmap::dispose() + { HL_Vector aItemsCopy = m_pImpl->getHyperLabels(); m_pImpl->getHyperLabels().clear(); for ( HL_Vector::iterator i = aItemsCopy.begin(); i != aItemsCopy.end(); ++i ) @@ -214,6 +218,7 @@ namespace svt delete m_pImpl->InCompleteHyperLabel; delete m_pImpl; m_pImpl = NULL; + Control::dispose(); } @@ -850,11 +855,6 @@ namespace svt } - IDLabel::~IDLabel( ) - { - } - - void IDLabel::DataChanged( const DataChangedEvent& rDCEvt ) { const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index 44d507cd9d5a..96d1a66ee391 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -326,12 +326,18 @@ Ruler::Ruler( vcl::Window* pParent, WinBits nWinStyle ) : Ruler::~Ruler() { + dispose(); +} + +void Ruler::dispose() +{ if ( mnUpdateEvtId ) Application::RemoveUserEvent( mnUpdateEvtId ); delete mpSaveData; delete mpDragData; if( pAccContext ) pAccContext->release(); + Window::dispose(); } void Ruler::ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 ) diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx index 09d32acecfc6..cc063c96cecf 100644 --- a/svtools/source/control/scrwin.cxx +++ b/svtools/source/control/scrwin.cxx @@ -30,10 +30,10 @@ void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags ) bScrolling = false; // set the handlers for the scrollbars - aVScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) ); - aHScroll.SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) ); - aVScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) ); - aHScroll.SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) ); + aVScroll->SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) ); + aHScroll->SetScrollHdl( LINK(this, ScrollableWindow, ScrollHdl) ); + aVScroll->SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) ); + aHScroll->SetEndScrollHdl( LINK(this, ScrollableWindow, EndScrollHdl) ); nColumnPixW = nLinePixH = GetSettings().GetStyleSettings().GetScrollBarSize(); } @@ -43,14 +43,27 @@ void ScrollableWindow::ImpInitialize( ScrollableWindowFlags nFlags ) ScrollableWindow::ScrollableWindow( vcl::Window* pParent, WinBits nBits, ScrollableWindowFlags nFlags ) : Window( pParent, WinBits(nBits|WB_CLIPCHILDREN) ), - aVScroll( this, WinBits(WB_VSCROLL | WB_DRAG) ), - aHScroll( this, WinBits(WB_HSCROLL | WB_DRAG) ), - aCornerWin( this ) + aVScroll( new ScrollBar(this, WinBits(WB_VSCROLL | WB_DRAG)) ), + aHScroll( new ScrollBar(this, WinBits(WB_HSCROLL | WB_DRAG)) ), + aCornerWin( new ScrollBarBox(this) ) { ImpInitialize( nFlags ); } +ScrollableWindow::~ScrollableWindow() +{ + dispose(); +} + +void ScrollableWindow::dispose() +{ + aVScroll.disposeAndClear(); + aHScroll.disposeAndClear(); + aCornerWin.disposeAndClear(); + Window::dispose(); +} + void ScrollableWindow::Command( const CommandEvent& rCEvt ) { @@ -60,12 +73,12 @@ void ScrollableWindow::Command( const CommandEvent& rCEvt ) { ScrollBar* pHScrBar; ScrollBar* pVScrBar; - if ( aHScroll.IsVisible() ) - pHScrBar = &aHScroll; + if ( aHScroll->IsVisible() ) + pHScrBar = aHScroll.get(); else pHScrBar = NULL; - if ( aVScroll.IsVisible() ) - pVScrBar = &aVScroll; + if ( aVScroll->IsVisible() ) + pVScrBar = aVScroll.get(); else pVScrBar = NULL; if ( HandleScrollCommand( rCEvt, pHScrBar, pVScrBar ) ) @@ -96,9 +109,9 @@ Size ScrollableWindow::GetOutputSizePixel() const Size aSz( Window::GetOutputSizePixel() ); long nTmp = GetSettings().GetStyleSettings().GetScrollBarSize(); - if ( aHScroll.IsVisible() ) + if ( aHScroll->IsVisible() ) aSz.Height() -= nTmp; - if ( aVScroll.IsVisible() ) + if ( aVScroll->IsVisible() ) aSz.Width() -= nTmp; return aSz; } @@ -112,12 +125,12 @@ IMPL_LINK( ScrollableWindow, EndScrollHdl, ScrollBar *, pScroll ) bScrolling = true; // get the delta in logic coordinates - Size aDelta( PixelToLogic( Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) ); + Size aDelta( PixelToLogic( Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) ); // scroll the window, if this is not already done if ( !bHandleDragging ) { - if ( pScroll == &aHScroll ) + if ( pScroll == aHScroll.get() ) Scroll( aDelta.Width(), 0 ); else Scroll( 0, aDelta.Height() ); @@ -140,8 +153,8 @@ IMPL_LINK( ScrollableWindow, ScrollHdl, ScrollBar *, pScroll ) { // get the delta in logic coordinates Size aDelta( PixelToLogic( - Size( aHScroll.GetDelta(), aVScroll.GetDelta() ) ) ); - if ( pScroll == &aHScroll ) + Size( aHScroll->GetDelta(), aVScroll->GetDelta() ) ) ); + if ( pScroll == aHScroll.get() ) Scroll( aDelta.Width(), 0 ); else Scroll( 0, aDelta.Height() ); @@ -219,9 +232,9 @@ void ScrollableWindow::Resize() ? (aOutPixSz.Height()-aTotPixSz.Height()) / 2 : 0 ) ); } - if ( bHVisible && !aHScroll.IsVisible() ) + if ( bHVisible && !aHScroll->IsVisible() ) aPixOffset.X() = 0; - if ( bVVisible && !aVScroll.IsVisible() ) + if ( bVVisible && !aVScroll->IsVisible() ) aPixOffset.Y() = 0; // select the shifted map-mode @@ -235,41 +248,41 @@ void ScrollableWindow::Resize() } // show or hide scrollbars - aVScroll.Show( bVVisible ); - aHScroll.Show( bHVisible ); + aVScroll->Show( bVVisible ); + aHScroll->Show( bHVisible ); // disable painting in the corner between the scrollbars if ( bVVisible && bHVisible ) { - aCornerWin.SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), + aCornerWin->SetPosSizePixel(Point(aOutPixSz.Width(), aOutPixSz.Height()), Size(nScrSize, nScrSize) ); - aCornerWin.Show(); + aCornerWin->Show(); } else - aCornerWin.Hide(); + aCornerWin->Hide(); // resize scrollbars and set their ranges if ( bHVisible ) { - aHScroll.SetPosSizePixel( + aHScroll->SetPosSizePixel( Point( 0, aOutPixSz.Height() ), Size( aOutPixSz.Width(), nScrSize ) ); - aHScroll.SetRange( Range( 0, aTotPixSz.Width() ) ); - aHScroll.SetPageSize( aOutPixSz.Width() ); - aHScroll.SetVisibleSize( aOutPixSz.Width() ); - aHScroll.SetLineSize( nColumnPixW ); - aHScroll.SetThumbPos( -aPixOffset.X() ); + aHScroll->SetRange( Range( 0, aTotPixSz.Width() ) ); + aHScroll->SetPageSize( aOutPixSz.Width() ); + aHScroll->SetVisibleSize( aOutPixSz.Width() ); + aHScroll->SetLineSize( nColumnPixW ); + aHScroll->SetThumbPos( -aPixOffset.X() ); } if ( bVVisible ) { - aVScroll.SetPosSizePixel( + aVScroll->SetPosSizePixel( Point( aOutPixSz.Width(), 0 ), Size( nScrSize,aOutPixSz.Height() ) ); - aVScroll.SetRange( Range( 0, aTotPixSz.Height() ) ); - aVScroll.SetPageSize( aOutPixSz.Height() ); - aVScroll.SetVisibleSize( aOutPixSz.Height() ); - aVScroll.SetLineSize( nLinePixH ); - aVScroll.SetThumbPos( -aPixOffset.Y() ); + aVScroll->SetRange( Range( 0, aTotPixSz.Height() ) ); + aVScroll->SetPageSize( aOutPixSz.Height() ); + aVScroll->SetVisibleSize( aOutPixSz.Height() ); + aVScroll->SetLineSize( nLinePixH ); + aVScroll->SetThumbPos( -aPixOffset.Y() ); } } @@ -366,9 +379,9 @@ void ScrollableWindow::Scroll( long nDeltaX, long nDeltaY, sal_uInt16 ) if ( !bScrolling ) { if ( nDeltaX ) - aHScroll.SetThumbPos( -aPixOffset.X() ); + aHScroll->SetThumbPos( -aPixOffset.X() ); if ( nDeltaY ) - aVScroll.SetThumbPos( -aPixOffset.Y() ); + aVScroll->SetThumbPos( -aPixOffset.Y() ); } } diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 45807d372c26..ab6e8d0c49ba 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -372,7 +372,13 @@ TabBar::TabBar( vcl::Window* pParent, WinBits nWinStyle ) : TabBar::~TabBar() { + dispose(); +} + +void TabBar::dispose() +{ EndEditMode( true ); + Window::dispose(); } const sal_uInt16 TabBar::APPEND = ::std::numeric_limits<sal_uInt16>::max(); diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 1896c2b28b71..39ced9f0f453 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -459,6 +459,11 @@ void ToolbarMenu::implInit(const Reference< XFrame >& rFrame) ToolbarMenu::~ToolbarMenu() { + dispose(); +} + +void ToolbarMenu::dispose() +{ vcl::Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) static_cast<SystemWindow*>(pWindow)->GetTaskPaneList()->RemoveWindow( this ); @@ -478,6 +483,7 @@ ToolbarMenu::~ToolbarMenu() } delete mpImpl; + DockingWindow::dispose(); } diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 67d28733fb80..1a409702164f 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -125,11 +125,17 @@ ValueSet::ValueSet( vcl::Window* pParent, const ResId& rResId, bool bDisableTran ValueSet::~ValueSet() { + dispose(); +} + +void ValueSet::dispose() +{ Reference<XComponent> xComponent(GetAccessible(false), UNO_QUERY); if (xComponent.is()) xComponent->dispose(); ImplDeleteItems(); + Control::dispose(); } void ValueSet::ImplDeleteItems() diff --git a/svtools/source/dialogs/PlaceEditDialog.cxx b/svtools/source/dialogs/PlaceEditDialog.cxx index f6a76fa1ab79..b4461747aab5 100644 --- a/svtools/source/dialogs/PlaceEditDialog.cxx +++ b/svtools/source/dialogs/PlaceEditDialog.cxx @@ -79,10 +79,6 @@ PlaceEditDialog::PlaceEditDialog(vcl::Window* pParent, const std::shared_ptr<Pla } } -PlaceEditDialog::~PlaceEditDialog() -{ -} - OUString PlaceEditDialog::GetServerUrl() { OUString sUrl; diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 419b2b9efcc3..050cf49b4ee3 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -733,7 +733,13 @@ void AssignmentPersistentData::ImplCommit() AddressBookSourceDialog::~AddressBookSourceDialog() { + dispose(); + } + + void AddressBookSourceDialog::dispose() + { delete m_pImpl; + ModalDialog::dispose(); } diff --git a/svtools/source/dialogs/prnsetup.cxx b/svtools/source/dialogs/prnsetup.cxx index 498f03862ecb..f824d9c48992 100644 --- a/svtools/source/dialogs/prnsetup.cxx +++ b/svtools/source/dialogs/prnsetup.cxx @@ -245,8 +245,14 @@ PrinterSetupDialog::PrinterSetupDialog(vcl::Window* pParent) PrinterSetupDialog::~PrinterSetupDialog() { + dispose(); +} + +void PrinterSetupDialog::dispose() +{ ImplFreePrnDlgListBox(m_pLbName, false); delete mpTempPrinter; + ModalDialog::dispose(); } diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index aa9fb5c0843d..68291f9f1646 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -154,7 +154,13 @@ namespace svt RoadmapWizard::~RoadmapWizard() { + dispose(); + } + + void RoadmapWizard::dispose() + { delete m_pImpl; + OWizardMachine::dispose(); } diff --git a/svtools/source/dialogs/wizardmachine.cxx b/svtools/source/dialogs/wizardmachine.cxx index 4339551d35dc..dd3b37aea806 100644 --- a/svtools/source/dialogs/wizardmachine.cxx +++ b/svtools/source/dialogs/wizardmachine.cxx @@ -49,6 +49,11 @@ namespace svt OWizardPage::~OWizardPage() { + dispose(); + } + + void OWizardPage::dispose() + { delete m_pImpl; } @@ -196,6 +201,11 @@ namespace svt OWizardMachine::~OWizardMachine() { + dispose(); + } + + void OWizardMachine::dispose() + { delete m_pFinish; delete m_pCancel; delete m_pNextPage; @@ -206,6 +216,7 @@ namespace svt delete GetPage(i); delete m_pImpl; + WizardDialog::dispose(); } diff --git a/svtools/source/dialogs/wizdlg.cxx b/svtools/source/dialogs/wizdlg.cxx index e52031383900..c38c6944678d 100644 --- a/svtools/source/dialogs/wizdlg.cxx +++ b/svtools/source/dialogs/wizdlg.cxx @@ -363,6 +363,11 @@ WizardDialog::WizardDialog( vcl::Window* pParent, const OUString& rID, const OUS WizardDialog::~WizardDialog() { + dispose(); +} + +void WizardDialog::dispose() +{ maWizardLayoutIdle.Stop(); // Remove all buttons @@ -372,6 +377,8 @@ WizardDialog::~WizardDialog() // Remove all pages while ( mpFirstPage ) RemovePage( mpFirstPage->mpPage ); + + ModalDialog::dispose(); } diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 8b8bbb6228fa..3d2c97701204 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -36,10 +36,6 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeMultiLineEditSyntaxHig return new MultiLineEditSyntaxHighlight(pParent); } -MultiLineEditSyntaxHighlight::~MultiLineEditSyntaxHighlight() -{ -} - void MultiLineEditSyntaxHighlight::SetText(const OUString& rNewText) { MultiLineEdit::SetText(rNewText); diff --git a/svtools/source/edit/svmedit2.cxx b/svtools/source/edit/svmedit2.cxx index 9bb4c5f85478..4024cccdc9d5 100644 --- a/svtools/source/edit/svmedit2.cxx +++ b/svtools/source/edit/svmedit2.cxx @@ -22,13 +22,7 @@ #include <vcl/xtextedt.hxx> ExtMultiLineEdit::ExtMultiLineEdit( vcl::Window* pParent, WinBits nWinStyle ) : - MultiLineEdit( pParent, nWinStyle ) - -{ -} - -ExtMultiLineEdit::~ExtMultiLineEdit() { } diff --git a/svtools/source/filter/GraphicExportOptionsDialog.cxx b/svtools/source/filter/GraphicExportOptionsDialog.cxx index 20e2ed7fc28d..3fe1d195a35a 100644 --- a/svtools/source/filter/GraphicExportOptionsDialog.cxx +++ b/svtools/source/filter/GraphicExportOptionsDialog.cxx @@ -43,9 +43,6 @@ GraphicExportOptionsDialog::GraphicExportOptionsDialog(vcl::Window* pWindow, con updateResolution(); } -GraphicExportOptionsDialog::~GraphicExportOptionsDialog() -{} - void GraphicExportOptionsDialog::initialize() { mCurrentPage = mRenderer.getCurrentPageWriter(); diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index 024d6b13030a..5c63ea853727 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -979,8 +979,14 @@ void ExportDialog::updateControls() ExportDialog::~ExportDialog() { + dispose(); +} + +void ExportDialog::dispose() +{ delete mpFilterOptionsItem; delete mpOptionsItem; + ModalDialog::dispose(); } diff --git a/svtools/source/filter/exportdialog.hxx b/svtools/source/filter/exportdialog.hxx index 3cc1cd6968b4..8defef2bfd7f 100644 --- a/svtools/source/filter/exportdialog.hxx +++ b/svtools/source/filter/exportdialog.hxx @@ -127,9 +127,9 @@ private: com::sun::star::awt::Size maSize; // for vector graphics it always contains the logical size in 1/100mm - bool mbIsPixelFormat; - bool mbExportSelection; - bool mbPreserveAspectRatio; + bool mbIsPixelFormat; + bool mbExportSelection; + bool mbPreserveAspectRatio; sal_Int32 mnInitialResolutionUnit; @@ -179,6 +179,7 @@ public: const com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& rxSourceDocument, bool bExportSelection, bool bIsExportVectorFormat ); virtual ~ExportDialog(); + virtual void dispose() SAL_OVERRIDE; }; diff --git a/svtools/source/inc/svimpbox.hxx b/svtools/source/inc/svimpbox.hxx index b2802168ba29..82683a5bca0e 100644 --- a/svtools/source/inc/svimpbox.hxx +++ b/svtools/source/inc/svimpbox.hxx @@ -96,9 +96,9 @@ private: SvTreeListEntry* pActiveEntry; SvLBoxTab* pActiveTab; - ScrollBar aVerSBar; - ScrollBar aHorSBar; - ScrollBarBox aScrBarBox; + VclPtr<ScrollBar> aVerSBar; + VclPtr<ScrollBar> aHorSBar; + VclPtr<ScrollBarBox> aScrBarBox; ::svt::AccessibleFactoryAccess m_aFactoryAccess; @@ -329,7 +329,7 @@ public: void SetUpdateMode( bool bMode ); bool GetUpdateMode() const { return bUpdateMode; } Rectangle GetClipRegionRect() const; - bool HasHorScrollBar() const { return aHorSBar.IsVisible(); } + bool HasHorScrollBar() const { return aHorSBar->IsVisible(); } void ShowFocusRect( const SvTreeListEntry* pEntry ); void CallEventListeners( sal_uLong nEvent, void* pData = NULL ); diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index de59f689012d..d6b0485b04e4 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -64,11 +64,17 @@ namespace svt { namespace table TableControl::~TableControl() { + dispose(); + } + + void TableControl::dispose() + { CallEventListeners( VCLEVENT_OBJECT_DYING ); m_pImpl->setModel( PTableModel() ); m_pImpl->disposeAccessible(); m_pImpl.reset(); + Control::dispose(); } diff --git a/svtools/source/table/tabledatawindow.cxx b/svtools/source/table/tabledatawindow.cxx index cddaf452732c..b71c5821d02c 100644 --- a/svtools/source/table/tabledatawindow.cxx +++ b/svtools/source/table/tabledatawindow.cxx @@ -51,7 +51,13 @@ namespace svt { namespace table TableDataWindow::~TableDataWindow() { + dispose(); + } + + void TableDataWindow::dispose() + { impl_hideTipWindow(); + Window::dispose(); } void TableDataWindow::Paint( const Rectangle& rUpdateRect ) diff --git a/svtools/source/table/tabledatawindow.hxx b/svtools/source/table/tabledatawindow.hxx index 13e1f1fcb0a7..d5ce17192b11 100644 --- a/svtools/source/table/tabledatawindow.hxx +++ b/svtools/source/table/tabledatawindow.hxx @@ -49,6 +49,7 @@ namespace svt { namespace table public: TableDataWindow( TableControl_Impl& _rTableControl ); virtual ~TableDataWindow(); + virtual void dispose() SAL_OVERRIDE; inline void SetSelectHdl( const Link& rLink ) { m_aSelectHdl = rLink; } inline const Link& GetSelectHdl() const { return m_aSelectHdl; } diff --git a/svtools/source/toolpanel/paneltabbar.cxx b/svtools/source/toolpanel/paneltabbar.cxx index 91c1304ddb80..33bf1df1d3f5 100644 --- a/svtools/source/toolpanel/paneltabbar.cxx +++ b/svtools/source/toolpanel/paneltabbar.cxx @@ -378,8 +378,8 @@ namespace svt void UpdateScrollButtons() { - m_aScrollBack.Enable( m_nScrollPosition > 0 ); - m_aScrollForward.Enable( m_nScrollPosition < m_aItems.size() - 1 ); + m_aScrollBack->Enable( m_nScrollPosition > 0 ); + m_aScrollForward->Enable( m_nScrollPosition < m_aItems.size() - 1 ); } void Relayout(); @@ -425,8 +425,8 @@ namespace svt ItemDescriptors m_aItems; bool m_bItemsDirty; - PushButton m_aScrollBack; - PushButton m_aScrollForward; + VclPtr<PushButton> m_aScrollBack; + VclPtr<PushButton> m_aScrollForward; size_t m_nScrollPosition; }; @@ -506,8 +506,8 @@ namespace svt ,m_bMouseButtonDown( false ) ,m_aItems() ,m_bItemsDirty( true ) - ,m_aScrollBack( &i_rTabBar, WB_BEVELBUTTON ) - ,m_aScrollForward( &i_rTabBar, WB_BEVELBUTTON ) + ,m_aScrollBack( new PushButton(&i_rTabBar, WB_BEVELBUTTON) ) + ,m_aScrollForward( new PushButton(&i_rTabBar, WB_BEVELBUTTON) ) ,m_nScrollPosition( 0 ) { #ifdef WNT @@ -527,17 +527,17 @@ namespace svt m_rPanelDeck.AddListener( *this ); - m_aScrollBack.SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT ); - m_aScrollBack.Show(); - m_aScrollBack.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollBack.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() ); - m_aScrollBack.SetAccessibleName( m_aScrollBack.GetAccessibleDescription() ); - - m_aScrollForward.SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT ); - m_aScrollForward.Show(); - m_aScrollForward.SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); - m_aScrollForward.SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() ); - m_aScrollForward.SetAccessibleName( m_aScrollForward.GetAccessibleDescription() ); + m_aScrollBack->SetSymbol( IsVertical() ? SymbolType::ARROW_UP : SymbolType::ARROW_LEFT ); + m_aScrollBack->Show(); + m_aScrollBack->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + m_aScrollBack->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_FWD ).toString() ); + m_aScrollBack->SetAccessibleName( m_aScrollBack->GetAccessibleDescription() ); + + m_aScrollForward->SetSymbol( IsVertical() ? SymbolType::ARROW_DOWN : SymbolType::ARROW_RIGHT ); + m_aScrollForward->Show(); + m_aScrollForward->SetClickHdl( LINK( this, PanelTabBar_Impl, OnScroll ) ); + m_aScrollForward->SetAccessibleDescription( SvtResId( STR_SVT_TOOL_PANEL_BUTTON_BACK ).toString() ); + m_aScrollForward->SetAccessibleName( m_aScrollForward->GetAccessibleDescription() ); } @@ -840,24 +840,24 @@ namespace svt if ( m_aGeometry.getButtonBackRect().IsEmpty() ) { - m_aScrollBack.Hide(); + m_aScrollBack->Hide(); } else { const Rectangle aButtonBack( m_aNormalizer.getTransformed( m_aGeometry.getButtonBackRect(), m_eTabAlignment ) ); - m_aScrollBack.SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); - m_aScrollBack.Show(); + m_aScrollBack->SetPosSizePixel( aButtonBack.TopLeft(), aButtonBack.GetSize() ); + m_aScrollBack->Show(); } if ( m_aGeometry.getButtonForwardRect().IsEmpty() ) { - m_aScrollForward.Hide(); + m_aScrollForward->Hide(); } else { const Rectangle aButtonForward( m_aNormalizer.getTransformed( m_aGeometry.getButtonForwardRect(), m_eTabAlignment ) ); - m_aScrollForward.SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); - m_aScrollForward.Show(); + m_aScrollForward->SetPosSizePixel( aButtonForward.TopLeft(), aButtonForward.GetSize() ); + m_aScrollForward->Show(); } UpdateScrollButtons(); @@ -921,13 +921,13 @@ namespace svt IMPL_LINK( PanelTabBar_Impl, OnScroll, const PushButton*, i_pButton ) { - if ( i_pButton == &m_aScrollBack ) + if ( i_pButton == m_aScrollBack.get() ) { OSL_ENSURE( m_nScrollPosition > 0, "PanelTabBar_Impl::OnScroll: inconsistency!" ); --m_nScrollPosition; m_rTabBar.Invalidate(); } - else if ( i_pButton == &m_aScrollForward ) + else if ( i_pButton == m_aScrollForward.get() ) { OSL_ENSURE( m_nScrollPosition < m_aItems.size() - 1, "PanelTabBar_Impl::OnScroll: inconsistency!" ); ++m_nScrollPosition; @@ -996,11 +996,15 @@ namespace svt DBG_CHECK( *m_pImpl ); } - PanelTabBar::~PanelTabBar() { + dispose(); } + void PanelTabBar::dispose() + { + Control::dispose(); + } TabItemContent PanelTabBar::GetTabItemContent() const { @@ -1314,7 +1318,7 @@ namespace svt PushButton& PanelTabBar::GetScrollButton( const bool i_bForward ) { - return i_bForward ? m_pImpl->m_aScrollForward : m_pImpl->m_aScrollBack; + return i_bForward ? *m_pImpl->m_aScrollForward.get() : *m_pImpl->m_aScrollBack.get(); } diff --git a/svtools/source/toolpanel/toolpaneldeck.cxx b/svtools/source/toolpanel/toolpaneldeck.cxx index af00abb8c204..c5a733c5efcd 100644 --- a/svtools/source/toolpanel/toolpaneldeck.cxx +++ b/svtools/source/toolpanel/toolpaneldeck.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/accessibility/AccessibleRole.hpp> #include <tools/diagnose_ex.h> +#include <vcl/vclptr.hxx> #include <boost/optional.hpp> @@ -68,15 +69,15 @@ namespace svt public: ToolPanelDeck_Impl( ToolPanelDeck& i_rDeck ) :m_rDeck( i_rDeck ) - ,m_aPanelAnchor( &i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL ) + ,m_aPanelAnchor( new vcl::Window(&i_rDeck, WB_DIALOGCONTROL | WB_CHILDDLGCTRL) ) ,m_aPanels() ,m_pDummyPanel( new DummyPanel ) ,m_pLayouter() ,m_bInDtor( false ) { m_aPanels.AddListener( *this ); - m_aPanelAnchor.Show(); - m_aPanelAnchor.SetAccessibleRole( AccessibleRole::PANEL ); + m_aPanelAnchor->Show(); + m_aPanelAnchor->SetAccessibleRole( AccessibleRole::PANEL ); } virtual ~ToolPanelDeck_Impl() @@ -87,7 +88,7 @@ namespace svt PDeckLayouter GetLayouter() const { return m_pLayouter; } void SetLayouter( const PDeckLayouter& i_pNewLayouter ); - vcl::Window& GetPanelWindowAnchor() { return m_aPanelAnchor; } + vcl::Window& GetPanelWindowAnchor() { return *m_aPanelAnchor.get(); } bool IsDead() const { return m_bInDtor; } @@ -130,7 +131,7 @@ namespace svt private: ToolPanelDeck& m_rDeck; - vcl::Window m_aPanelAnchor; + VclPtr<vcl::Window> m_aPanelAnchor; ToolPanelCollection m_aPanels; PToolPanel m_pDummyPanel; PanelDeckListeners m_aListeners; @@ -210,11 +211,11 @@ namespace svt { aPlaygroundArea = m_pLayouter->Layout( aDeckPlayground ); } - m_aPanelAnchor.SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() ); + m_aPanelAnchor->SetPosSizePixel( aPlaygroundArea.TopLeft(), aPlaygroundArea.GetSize() ); // position the active panel const PToolPanel pActive( GetActiveOrDummyPanel_Impl() ); - pActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() ); + pActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() ); } @@ -261,7 +262,7 @@ namespace svt case ACTION_TOGGLE_FOCUS: { PToolPanel pActivePanel( GetActiveOrDummyPanel_Impl() ); - if ( !m_aPanelAnchor.HasChildPathFocus() ) + if ( !m_aPanelAnchor->HasChildPathFocus() ) pActivePanel->GrabFocus(); else GetLayouter()->SetFocusToPanelSelector(); @@ -313,11 +314,11 @@ namespace svt // position and show the new panel const PToolPanel pNewActive( !i_rNewActive ? m_pDummyPanel : m_aPanels.GetPanel( *i_rNewActive ) ); - pNewActive->Activate( m_aPanelAnchor ); + pNewActive->Activate( *m_aPanelAnchor.get() ); pNewActive->GrabFocus(); // resize the panel (cannot guarantee it has ever been resized before - pNewActive->SetSizePixel( m_aPanelAnchor.GetOutputSizePixel() ); + pNewActive->SetSizePixel( m_aPanelAnchor->GetOutputSizePixel() ); // multiplex to our own listeners m_aListeners.ActivePanelChanged( i_rOldActive, i_rNewActive ); @@ -353,6 +354,11 @@ namespace svt ToolPanelDeck::~ToolPanelDeck() { + dispose(); + } + + void ToolPanelDeck::dispose() + { m_pImpl->NotifyDying(); GetLayouter()->Destroy(); @@ -362,6 +368,7 @@ namespace svt PToolPanel pPanel( GetPanel( i ) ); pPanel->Dispose(); } + Control::dispose(); } diff --git a/svtools/source/toolpanel/toolpaneldrawer.cxx b/svtools/source/toolpanel/toolpaneldrawer.cxx index d74545593d1c..02ae7b230b53 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.cxx +++ b/svtools/source/toolpanel/toolpaneldrawer.cxx @@ -56,11 +56,6 @@ namespace svt } - DrawerVisualization::~DrawerVisualization() - { - } - - void DrawerVisualization::Paint( const Rectangle& i_rBoundingBox ) { Window::Paint( i_rBoundingBox ); @@ -74,7 +69,7 @@ namespace svt ToolPanelDrawer::ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle ) :Window( &i_rParent, WB_TABSTOP ) ,m_pPaintDevice( new VirtualDevice( *this ) ) - ,m_aVisualization( *this ) + ,m_aVisualization( new DrawerVisualization(*this) ) ,m_bFocused( false ) ,m_bExpanded( false ) { @@ -88,15 +83,11 @@ namespace svt SetAccessibleName( i_rTitle ); SetAccessibleDescription( i_rTitle ); - m_aVisualization.SetAccessibleName( i_rTitle ); - m_aVisualization.SetAccessibleDescription( i_rTitle ); + m_aVisualization->SetAccessibleName( i_rTitle ); + m_aVisualization->SetAccessibleDescription( i_rTitle ); } - ToolPanelDrawer::~ToolPanelDrawer() - { - } - long ToolPanelDrawer::GetPreferredHeightPixel() const { @@ -123,7 +114,7 @@ namespace svt aFocusBox.Left() += 2; impl_paintFocusIndicator( aFocusBox ); - m_aVisualization.DrawOutDev( + m_aVisualization->DrawOutDev( Point(), GetOutputSizePixel(), Point(), GetOutputSizePixel(), *m_pPaintDevice @@ -239,7 +230,7 @@ namespace svt void ToolPanelDrawer::Resize() { Window::Resize(); - m_aVisualization.SetPosSizePixel( Point(), GetOutputSizePixel() ); + m_aVisualization->SetPosSizePixel( Point(), GetOutputSizePixel() ); } diff --git a/svtools/source/toolpanel/toolpaneldrawer.hxx b/svtools/source/toolpanel/toolpaneldrawer.hxx index 3a815345e2b6..a1d1a94da517 100644 --- a/svtools/source/toolpanel/toolpaneldrawer.hxx +++ b/svtools/source/toolpanel/toolpaneldrawer.hxx @@ -22,6 +22,7 @@ #include <vcl/window.hxx> #include <vcl/virdev.hxx> +#include <vcl/vclptr.hxx> namespace svt @@ -45,7 +46,6 @@ namespace svt { public: DrawerVisualization( ToolPanelDrawer& i_rParent ); - virtual ~DrawerVisualization(); protected: // Window overridables @@ -63,7 +63,6 @@ namespace svt { public: ToolPanelDrawer( vcl::Window& i_rParent, const OUString& i_rTitle ); - virtual ~ToolPanelDrawer(); long GetPreferredHeightPixel() const; void SetExpanded( const bool i_bExpanded ); @@ -97,7 +96,7 @@ namespace svt private: ::std::unique_ptr< VirtualDevice > m_pPaintDevice; - DrawerVisualization m_aVisualization; + VclPtr<DrawerVisualization> m_aVisualization; bool m_bFocused; bool m_bExpanded; }; diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index c4a04f9ecc78..c575890de7fc 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -86,6 +86,7 @@ class UnoTreeListBoxImpl : public SvTreeListBox public: UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pParent, WinBits nWinStyle ); virtual ~UnoTreeListBoxImpl(); + virtual void dispose() SAL_OVERRIDE; sal_uInt32 insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,sal_uLong nPos=TREELIST_APPEND ); @@ -1490,8 +1491,14 @@ UnoTreeListBoxImpl::UnoTreeListBoxImpl( TreeControlPeer* pPeer, vcl::Window* pPa UnoTreeListBoxImpl::~UnoTreeListBoxImpl() { + dispose(); +} + +void UnoTreeListBoxImpl::dispose() +{ if( mxPeer.is() ) mxPeer->disposeControl(); + SvTreeListBox::dispose(); } diff --git a/svtools/source/uno/wizard/wizardshell.cxx b/svtools/source/uno/wizard/wizardshell.cxx index d10db321ee60..2f09342e8b85 100644 --- a/svtools/source/uno/wizard/wizardshell.cxx +++ b/svtools/source/uno/wizard/wizardshell.cxx @@ -90,11 +90,6 @@ namespace svt { namespace uno } - WizardShell::~WizardShell() - { - } - - short WizardShell::Execute() { ActivatePage(); diff --git a/svtools/source/uno/wizard/wizardshell.hxx b/svtools/source/uno/wizard/wizardshell.hxx index 4d2e3e8f0315..19b6e72f67c6 100644 --- a/svtools/source/uno/wizard/wizardshell.hxx +++ b/svtools/source/uno/wizard/wizardshell.hxx @@ -48,7 +48,6 @@ namespace svt { namespace uno const ::com::sun::star::uno::Reference< ::com::sun::star::ui::dialogs::XWizardController >& i_rController, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int16 > >& i_rPaths ); - virtual ~WizardShell(); // Dialog overridables virtual short Execute() SAL_OVERRIDE; diff --git a/toolkit/source/awt/scrollabledialog.cxx b/toolkit/source/awt/scrollabledialog.cxx index 823fba383af5..71525b101205 100644 --- a/toolkit/source/awt/scrollabledialog.cxx +++ b/toolkit/source/awt/scrollabledialog.cxx @@ -31,11 +31,17 @@ namespace toolkit // in the same bitmap :-( WB_VSCROLL & WB_HSCROLL apparently are only for // child classes ( whole thing is a mess if you ask me ) template< class T> -ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle ) : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ), maHScrollBar( this, WB_HSCROLL | WB_DRAG), maVScrollBar( this, WB_VSCROLL | WB_DRAG ), mbHasHoriBar( false ), mbHasVertBar( false ), maScrollVis( None ) +ScrollableWrapper<T>::ScrollableWrapper( vcl::Window* pParent, WinBits nStyle ) + : T( pParent, nStyle & ~( WB_AUTOHSCROLL | WB_AUTOVSCROLL ) ), + maHScrollBar( new ScrollBar(this, WB_HSCROLL | WB_DRAG) ), + maVScrollBar( new ScrollBar(this, WB_VSCROLL | WB_DRAG) ), + mbHasHoriBar( false ), + mbHasVertBar( false ), + maScrollVis( None ) { Link aLink( LINK( this, ScrollableWrapper, ScrollBarHdl ) ); - maVScrollBar.SetScrollHdl( aLink ); - maHScrollBar.SetScrollHdl( aLink ); + maVScrollBar->SetScrollHdl( aLink ); + maHScrollBar->SetScrollHdl( aLink ); ScrollBarVisibility aVis = None; @@ -62,12 +68,12 @@ void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState ) if ( maScrollVis == Hori || maScrollVis == Both ) { mbHasHoriBar = true; - maHScrollBar.Show(); + maHScrollBar->Show(); } if ( maScrollVis == Vert || maScrollVis == Both ) { mbHasVertBar = true; - maVScrollBar.Show(); + maVScrollBar->Show(); } if ( mbHasHoriBar || mbHasVertBar ) this->SetStyle( T::GetStyle() | WB_CLIPCHILDREN | SCROLL_UPDATE ); @@ -76,6 +82,15 @@ void ScrollableWrapper<T>::setScrollVisibility( ScrollBarVisibility rVisState ) template< class T> ScrollableWrapper<T>::~ScrollableWrapper() { + dispose(); +} + +template< class T> +void ScrollableWrapper<T>::dispose() +{ + maHScrollBar.disposeAndClear(); + maVScrollBar.disposeAndClear(); + T::dispose(); } template< class T> @@ -91,7 +106,7 @@ void ScrollableWrapper<T>::lcl_Scroll( long nX, long nY ) for ( int index = 0; index < T::GetChildCount(); ++index ) { vcl::Window* pChild = T::GetChild( index ); - if ( pChild && pChild != &maVScrollBar && pChild != &maHScrollBar ) + if ( pChild && pChild != maVScrollBar.get() && pChild != maHScrollBar.get() ) { Point aPos = pChild->GetPosPixel(); aPos += Point( nXScroll, nYScroll ); @@ -113,9 +128,9 @@ template< class T> sal_IntPtr ScrollableWrapper<T>::ScrollBarHdl( ScrollBar* pSB ) { sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos(); - if( pSB == &maVScrollBar ) + if( pSB == maVScrollBar.get() ) lcl_Scroll(mnScrollPos.X(), nPos ); - else if( pSB == &maHScrollBar ) + else if( pSB == maHScrollBar.get() ) lcl_Scroll(nPos, mnScrollPos.Y() ); return 1; } @@ -125,7 +140,7 @@ void ScrollableWrapper<T>::SetScrollTop( long nTop ) { Point aOld = mnScrollPos; lcl_Scroll( mnScrollPos.X() , mnScrollPos.Y() - nTop ); - maHScrollBar.SetThumbPos( 0 ); + maHScrollBar->SetThumbPos( 0 ); // new pos is 0,0 mnScrollPos = aOld; } @@ -134,7 +149,7 @@ void ScrollableWrapper<T>::SetScrollLeft( long nLeft ) { Point aOld = mnScrollPos; lcl_Scroll( mnScrollPos.X() - nLeft , mnScrollPos.Y() ); - maVScrollBar.SetThumbPos( 0 ); + maVScrollBar->SetThumbPos( 0 ); // new pos is 0,0 mnScrollPos = aOld; } @@ -166,14 +181,14 @@ void ScrollableWrapper<T>::ResetScrollBars() Point aVPos( aOutSz.Width() - mnScrWidth, 0 ); Point aHPos( 0, aOutSz.Height() - mnScrWidth ); - maVScrollBar.SetPosSizePixel( aVPos, Size( mnScrWidth, T::GetSizePixel().Height() - mnScrWidth ) ); - maHScrollBar.SetPosSizePixel( aHPos, Size( T::GetSizePixel().Width() - mnScrWidth, mnScrWidth ) ); + maVScrollBar->SetPosSizePixel( aVPos, Size( mnScrWidth, T::GetSizePixel().Height() - mnScrWidth ) ); + maHScrollBar->SetPosSizePixel( aHPos, Size( T::GetSizePixel().Width() - mnScrWidth, mnScrWidth ) ); - maHScrollBar.SetRangeMax( maScrollArea.Width() + mnScrWidth ); - maHScrollBar.SetVisibleSize( T::GetSizePixel().Width() ); + maHScrollBar->SetRangeMax( maScrollArea.Width() + mnScrWidth ); + maHScrollBar->SetVisibleSize( T::GetSizePixel().Width() ); - maVScrollBar.SetRangeMax( maScrollArea.Height() + mnScrWidth ); - maVScrollBar.SetVisibleSize( T::GetSizePixel().Height() ); + maVScrollBar->SetRangeMax( maScrollArea.Height() + mnScrWidth ); + maVScrollBar->SetVisibleSize( T::GetSizePixel().Height() ); } template class ScrollableWrapper< Dialog >; |