[Libreoffice-commits] core.git: Branch 'feature/vclptr' - 6 commits - basctl/source compilerplugins/clang extensions/source filter/source formula/source include/dbaccess include/formula svx/source
Noel Grandin
noel at peralex.com
Thu Apr 9 13:31:19 PDT 2015
basctl/source/basicide/baside2b.cxx | 2
compilerplugins/clang/vclwidgets.cxx | 161 +++++++++++++-----
extensions/source/abpilot/abpfinalpage.cxx | 6
extensions/source/abpilot/abpfinalpage.hxx | 1
extensions/source/abpilot/abspilot.cxx | 5
extensions/source/abpilot/abspilot.hxx | 2
extensions/source/abpilot/typeselectionpage.cxx | 6
extensions/source/abpilot/typeselectionpage.hxx | 1
extensions/source/bibliography/bibbeam.cxx | 14 +
extensions/source/bibliography/bibbeam.hxx | 1
extensions/source/bibliography/bibcont.cxx | 21 +-
extensions/source/bibliography/bibcont.hxx | 6
extensions/source/bibliography/bibshortcuthandler.hxx | 2
extensions/source/bibliography/bibview.cxx | 6
extensions/source/bibliography/bibview.hxx | 1
extensions/source/bibliography/general.cxx | 6
extensions/source/bibliography/general.hxx | 1
extensions/source/bibliography/toolbar.cxx | 78 ++++----
extensions/source/bibliography/toolbar.hxx | 13 -
extensions/source/propctrlr/browserline.cxx | 24 +-
extensions/source/propctrlr/browserline.hxx | 8
extensions/source/propctrlr/browserlistbox.cxx | 113 ++++++------
extensions/source/propctrlr/browserlistbox.hxx | 5
extensions/source/propctrlr/browserpage.cxx | 22 +-
extensions/source/propctrlr/browserpage.hxx | 7
extensions/source/propctrlr/browserview.cxx | 7
extensions/source/propctrlr/browserview.hxx | 1
extensions/source/propctrlr/inspectorhelpwindow.cxx | 47 +++--
extensions/source/propctrlr/inspectorhelpwindow.hxx | 6
extensions/source/propctrlr/propertyeditor.cxx | 117 ++++++-------
extensions/source/propctrlr/propertyeditor.hxx | 4
extensions/source/propctrlr/selectlabeldialog.cxx | 7
extensions/source/propctrlr/selectlabeldialog.hxx | 1
extensions/source/propctrlr/standardcontrol.cxx | 29 ++-
extensions/source/propctrlr/standardcontrol.hxx | 1
extensions/source/propctrlr/taborder.cxx | 7
extensions/source/propctrlr/taborder.hxx | 1
extensions/source/scanner/grid.cxx | 7
extensions/source/scanner/sanedlg.cxx | 6
extensions/source/scanner/sanedlg.hxx | 1
filter/source/pdf/impdialog.cxx | 12 +
filter/source/pdf/impdialog.hxx | 2
filter/source/svg/impsvgdialog.cxx | 91 +++++-----
filter/source/svg/impsvgdialog.hxx | 19 +-
filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 6
filter/source/xsltdialog/xmlfiltersettingsdialog.hxx | 1
filter/source/xsltdialog/xmlfiltertabdialog.cxx | 6
filter/source/xsltdialog/xmlfiltertabdialog.hxx | 1
filter/source/xsltdialog/xmlfiltertestdialog.cxx | 6
filter/source/xsltdialog/xmlfiltertestdialog.hxx | 1
formula/source/ui/dlg/ControlHelper.hxx | 1
formula/source/ui/dlg/funcutl.cxx | 12 +
formula/source/ui/dlg/parawin.cxx | 6
formula/source/ui/dlg/parawin.hxx | 1
include/dbaccess/dataview.hxx | 3
include/formula/funcutl.hxx | 1
svx/source/tbxctrls/tbcontrl.cxx | 2
57 files changed, 610 insertions(+), 315 deletions(-)
New commits:
commit 78626422af9ae7f8d7ab66b4cf9eb7551b322c8e
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jan 26 13:11:48 2015 +0200
vcl: VclPtr conversion in filter
Change-Id: I355315e19545610c1f26c94abe4e7d3fe19af867
diff --git a/filter/source/pdf/impdialog.cxx b/filter/source/pdf/impdialog.cxx
index e8d1e1e..4d08f14 100644
--- a/filter/source/pdf/impdialog.cxx
+++ b/filter/source/pdf/impdialog.cxx
@@ -312,6 +312,11 @@ IMPL_LINK_NOARG(ImpPDFTabDialog, CancelHdl)
ImpPDFTabDialog::~ImpPDFTabDialog()
{
+ dispose();
+}
+
+void ImpPDFTabDialog::dispose()
+{
//delete the pages, needed because otherwise the child tab pages
//don't get destroyed
RemoveTabPage(mnGeneralPageId);
@@ -320,6 +325,7 @@ ImpPDFTabDialog::~ImpPDFTabDialog()
RemoveTabPage(mnLinksPage);
RemoveTabPage(mnSecurityPageId);
RemoveTabPage(mnSigningPageId);
+ SfxTabDialog::dispose();
}
@@ -1511,9 +1517,15 @@ ImplErrorDialog::ImplErrorDialog(const std::set< vcl::PDFWriter::ErrorCode >& rE
ImplErrorDialog::~ImplErrorDialog()
{
+ dispose();
+}
+
+void ImplErrorDialog::dispose()
+{
// free strings again
for( sal_uInt16 n = 0; n < m_pErrors->GetEntryCount(); n++ )
delete static_cast<OUString*>(m_pErrors->GetEntryData( n ));
+ MessageDialog::dispose();
}
IMPL_LINK_NOARG(ImplErrorDialog, SelectHdl)
diff --git a/filter/source/pdf/impdialog.hxx b/filter/source/pdf/impdialog.hxx
index dc4a787..a913c9c 100644
--- a/filter/source/pdf/impdialog.hxx
+++ b/filter/source/pdf/impdialog.hxx
@@ -63,6 +63,7 @@ class ImplErrorDialog : public MessageDialog
public:
ImplErrorDialog( const std::set< vcl::PDFWriter::ErrorCode >& );
virtual ~ImplErrorDialog();
+ virtual void dispose() SAL_OVERRIDE;
};
class ImpPDFTabSecurityPage;
@@ -171,6 +172,7 @@ public:
const css::uno::Reference< XComponent >& rDoc
);
virtual ~ImpPDFTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
Sequence< PropertyValue > GetFilterData();
diff --git a/filter/source/svg/impsvgdialog.cxx b/filter/source/svg/impsvgdialog.cxx
index 5fd3e6d..228598b 100644
--- a/filter/source/svg/impsvgdialog.cxx
+++ b/filter/source/svg/impsvgdialog.cxx
@@ -36,73 +36,86 @@ inline sal_Int32 implMap( vcl::Window& /*rWnd*/, sal_Int32 nVal )
ImpSVGDialog::ImpSVGDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFilterData ) :
ModalDialog( pParent ),
- maFI( this ),
- maCBTinyProfile( this ),
- maCBEmbedFonts( this ),
- maCBUseNativeDecoration( this ),
- maBTOK( this, WB_DEF_OK ),
- maBTCancel( this ),
- maBTHelp( this ),
+ maFI( new FixedLine(this) ),
+ maCBTinyProfile( new CheckBox(this) ),
+ maCBEmbedFonts( new CheckBox(this) ),
+ maCBUseNativeDecoration( new CheckBox(this) ),
+ maBTOK( new OKButton(this, WB_DEF_OK) ),
+ maBTCancel( new CancelButton(this) ),
+ maBTHelp( new HelpButton(this) ),
maConfigItem( SVG_EXPORTFILTER_CONFIGPATH, &rFilterData ),
mbOldNativeDecoration( false )
{
SetText( "SVG Export Options" );
SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
- maFI.SetText( "Export" );
- maFI.SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
+ maFI->SetText( "Export" );
+ maFI->SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
- maCBTinyProfile.SetText( "Use SVG Tiny profile" );
- maCBTinyProfile.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
+ maCBTinyProfile->SetText( "Use SVG Tiny profile" );
+ maCBTinyProfile->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
- maCBEmbedFonts.SetText( "Embed fonts" );
- maCBEmbedFonts.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
+ maCBEmbedFonts->SetText( "Embed fonts" );
+ maCBEmbedFonts->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
- maCBUseNativeDecoration.SetText( "Use SVG native text decoration" );
- maCBUseNativeDecoration.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
+ maCBUseNativeDecoration->SetText( "Use SVG native text decoration" );
+ maCBUseNativeDecoration->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
- maCBTinyProfile.Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) );
- maCBEmbedFonts.Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) );
- maCBUseNativeDecoration.Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) );
+ maCBTinyProfile->Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) );
+ maCBEmbedFonts->Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) );
+ maCBUseNativeDecoration->Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) );
- maBTOK.SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
+ maBTOK->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
- maBTCancel.SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
+ maBTCancel->SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
- maBTHelp.SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
+ maBTHelp->SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
- maCBTinyProfile.SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
- OnToggleCheckbox( &maCBTinyProfile );
+ maCBTinyProfile->SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
+ OnToggleCheckbox( maCBTinyProfile.get() );
- maFI.Show();
+ maFI->Show();
- maCBTinyProfile.Show();
- maCBEmbedFonts.Show();
- maCBUseNativeDecoration.Show();
+ maCBTinyProfile->Show();
+ maCBEmbedFonts->Show();
+ maCBUseNativeDecoration->Show();
- maBTOK.Show();
- maBTCancel.Show();
- maBTHelp.Show();
+ maBTOK->Show();
+ maBTCancel->Show();
+ maBTHelp->Show();
}
ImpSVGDialog::~ImpSVGDialog()
{
+ dispose();
+}
+
+void ImpSVGDialog::dispose()
+{
+ maFI.disposeAndClear();
+ maCBTinyProfile.disposeAndClear();
+ maCBEmbedFonts.disposeAndClear();
+ maCBUseNativeDecoration.disposeAndClear();
+ maBTOK.disposeAndClear();
+ maBTCancel.disposeAndClear();
+ maBTHelp.disposeAndClear();
+ ModalDialog::dispose();
}
Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
{
- maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile.IsChecked() );
- maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts.IsChecked() );
- maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration.IsChecked() );
+ maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile->IsChecked() );
+ maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts->IsChecked() );
+ maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration->IsChecked() );
return( maConfigItem.GetFilterData() );
}
@@ -111,19 +124,19 @@ Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox )
{
- if( pBox == &maCBTinyProfile )
+ if( pBox == maCBTinyProfile.get() )
{
if( pBox->IsChecked() )
{
- mbOldNativeDecoration = maCBUseNativeDecoration.IsChecked();
+ mbOldNativeDecoration = maCBUseNativeDecoration->IsChecked();
- maCBUseNativeDecoration.Check( false );
- maCBUseNativeDecoration.Disable();
+ maCBUseNativeDecoration->Check( false );
+ maCBUseNativeDecoration->Disable();
}
else
{
- maCBUseNativeDecoration.Enable();
- maCBUseNativeDecoration.Check( mbOldNativeDecoration );
+ maCBUseNativeDecoration->Enable();
+ maCBUseNativeDecoration->Check( mbOldNativeDecoration );
}
}
diff --git a/filter/source/svg/impsvgdialog.hxx b/filter/source/svg/impsvgdialog.hxx
index 657cd9a..ada5b71 100644
--- a/filter/source/svg/impsvgdialog.hxx
+++ b/filter/source/svg/impsvgdialog.hxx
@@ -48,17 +48,17 @@ class ImpSVGDialog : public ModalDialog
{
private:
- FixedLine maFI;
- CheckBox maCBTinyProfile;
- CheckBox maCBEmbedFonts;
- CheckBox maCBUseNativeDecoration;
+ VclPtr<FixedLine> maFI;
+ VclPtr<CheckBox> maCBTinyProfile;
+ VclPtr<CheckBox> maCBEmbedFonts;
+ VclPtr<CheckBox> maCBUseNativeDecoration;
- OKButton maBTOK;
- CancelButton maBTCancel;
- HelpButton maBTHelp;
+ VclPtr<OKButton> maBTOK;
+ VclPtr<CancelButton> maBTCancel;
+ VclPtr<HelpButton> maBTHelp;
- FilterConfigItem maConfigItem;
- bool mbOldNativeDecoration;
+ FilterConfigItem maConfigItem;
+ bool mbOldNativeDecoration;
DECL_LINK( OnToggleCheckbox, CheckBox* );
@@ -67,6 +67,7 @@ public:
ImpSVGDialog( vcl::Window* pParent, /*ResMgr& rResMgr,*/
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rFilterData );
virtual ~ImpSVGDialog();
+ virtual void dispose() SAL_OVERRIDE;
com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetFilterData();
};
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
index 271db0b..57d8a3d 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx
@@ -1399,8 +1399,14 @@ Size SvxPathControl::GetOptimalSize() const
SvxPathControl::~SvxPathControl()
{
+ dispose();
+}
+
+void SvxPathControl::dispose()
+{
delete m_pFocusCtrl;
delete m_pHeaderBar;
+ vcl::Window::dispose();
}
extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeSvxPathControl(vcl::Window *pParent, VclBuilder::stringmap &)
diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
index 85bb4d7..beadad3 100644
--- a/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.hxx
@@ -50,6 +50,7 @@ public:
HeaderBar* getHeaderBar() { return m_pHeaderBar; }
XMLFilterListBox* getListBox() { return m_pFocusCtrl; }
virtual ~SvxPathControl();
+ virtual void dispose() SAL_OVERRIDE;
virtual bool Notify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
};
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.cxx b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
index 4494a74..b5e28d1 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.cxx
@@ -75,9 +75,15 @@ XMLFilterTabDialog::XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr,
XMLFilterTabDialog::~XMLFilterTabDialog()
{
+ dispose();
+}
+
+void XMLFilterTabDialog::dispose()
+{
delete mpBasicPage;
delete mpXSLTPage;
delete mpNewInfo;
+ TabDialog::dispose();
}
diff --git a/filter/source/xsltdialog/xmlfiltertabdialog.hxx b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
index 1ec8594..c07610e 100644
--- a/filter/source/xsltdialog/xmlfiltertabdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltertabdialog.hxx
@@ -36,6 +36,7 @@ class XMLFilterTabDialog: public TabDialog
public:
XMLFilterTabDialog(vcl::Window *pParent, ResMgr& rResMgr, const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, const filter_info_impl* pInfo);
virtual ~XMLFilterTabDialog();
+ virtual void dispose() SAL_OVERRIDE;
bool onOk();
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
index 359300e..5db2fac 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx
@@ -178,6 +178,11 @@ XMLFilterTestDialog::XMLFilterTestDialog(vcl::Window* pParent,
XMLFilterTestDialog::~XMLFilterTestDialog()
{
+ dispose();
+}
+
+void XMLFilterTestDialog::dispose()
+{
try
{
if( mxGlobalBroadcaster.is() )
@@ -189,6 +194,7 @@ XMLFilterTestDialog::~XMLFilterTestDialog()
}
delete m_pFilterInfo;
+ ModalDialog::dispose();
}
void XMLFilterTestDialog::test( const filter_info_impl& rFilterInfo )
diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.hxx b/filter/source/xsltdialog/xmlfiltertestdialog.hxx
index 4595348..776d7bc 100644
--- a/filter/source/xsltdialog/xmlfiltertestdialog.hxx
+++ b/filter/source/xsltdialog/xmlfiltertestdialog.hxx
@@ -37,6 +37,7 @@ public:
XMLFilterTestDialog(vcl::Window* pParent,
const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext);
virtual ~XMLFilterTestDialog();
+ virtual void dispose() SAL_OVERRIDE;
void test( const filter_info_impl& rFilterInfo );
commit 33d7f6dcfee48a33ce34e483a4249f0be0ffa4fe
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jan 26 13:11:36 2015 +0200
vcl: VclPtr conversion in formula
Change-Id: I6f9571a3ef1fbe5bb42ef665d85425b9902c1925
diff --git a/formula/source/ui/dlg/ControlHelper.hxx b/formula/source/ui/dlg/ControlHelper.hxx
index 4c7e564..574c853 100644
--- a/formula/source/ui/dlg/ControlHelper.hxx
+++ b/formula/source/ui/dlg/ControlHelper.hxx
@@ -48,6 +48,7 @@ public:
EditBox( vcl::Window* pParent, WinBits nBits );
virtual ~EditBox();
+ virtual void dispose() SAL_OVERRIDE;
MultiLineEdit* GetEdit() {return pMEdit;}
diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx
index d6313d4..ff60bc9 100644
--- a/formula/source/ui/dlg/funcutl.cxx
+++ b/formula/source/ui/dlg/funcutl.cxx
@@ -361,10 +361,16 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeEditBox(vcl::Window *p
EditBox::~EditBox()
{
+ dispose();
+}
+
+void EditBox::dispose()
+{
MultiLineEdit* pTheEdit=pMEdit;
pMEdit->Disable();
pMEdit=NULL;
delete pTheEdit;
+ Control::dispose();
}
// When the selection is changed this function will be called
@@ -481,8 +487,14 @@ extern "C" SAL_DLLPUBLIC_EXPORT vcl::Window* SAL_CALL makeRefEdit(vcl::Window *p
RefEdit::~RefEdit()
{
+ dispose();
+}
+
+void RefEdit::dispose()
+{
aIdle.SetIdleHdl( Link() );
aIdle.Stop();
+ Edit::dispose();
}
void RefEdit::SetRefString( const OUString& rStr )
diff --git a/formula/source/ui/dlg/parawin.cxx b/formula/source/ui/dlg/parawin.cxx
index 9e3a647..cff293a 100644
--- a/formula/source/ui/dlg/parawin.cxx
+++ b/formula/source/ui/dlg/parawin.cxx
@@ -221,6 +221,11 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
ParaWin::~ParaWin()
{
+ dispose();
+}
+
+void ParaWin::dispose()
+{
// #i66422# if the focus changes during destruction of the controls,
// don't call the focus handlers
Link aEmptyLink;
@@ -228,6 +233,7 @@ ParaWin::~ParaWin()
m_pBtnFx2->SetGetFocusHdl( aEmptyLink );
m_pBtnFx3->SetGetFocusHdl( aEmptyLink );
m_pBtnFx4->SetGetFocusHdl( aEmptyLink );
+ TabPage::dispose();
}
diff --git a/formula/source/ui/dlg/parawin.hxx b/formula/source/ui/dlg/parawin.hxx
index 5bf159b..c885d16 100644
--- a/formula/source/ui/dlg/parawin.hxx
+++ b/formula/source/ui/dlg/parawin.hxx
@@ -125,6 +125,7 @@ protected:
public:
ParaWin(vcl::Window* pParent,IControlReferenceHandler* _pDlg);
virtual ~ParaWin();
+ virtual void dispose() SAL_OVERRIDE;
void SetFunctionDesc(const IFunctionDescription* pFDesc);
void SetArgumentOffset(sal_uInt16 nOffset);
diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx
index bc40705..17713a7 100644
--- a/include/formula/funcutl.hxx
+++ b/include/formula/funcutl.hxx
@@ -48,6 +48,7 @@ public:
RefEdit( vcl::Window* _pParent, vcl::Window* pShrinkModeLabel, WinBits nStyle = WB_BORDER );
virtual ~RefEdit();
+ virtual void dispose() SAL_OVERRIDE;
void SetRefString( const OUString& rStr );
commit 1139e549240e2a02962360aadca227753d73a78c
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jan 26 13:11:07 2015 +0200
vcl: VclPtr conversion in extensions
Change-Id: Ie10e8fcb2bf413606063d4f1caab17bea1bb4d95
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx
index 1cf24b8..3092133 100644
--- a/extensions/source/abpilot/abpfinalpage.cxx
+++ b/extensions/source/abpilot/abpfinalpage.cxx
@@ -64,7 +64,13 @@ namespace abp
FinalPage::~FinalPage()
{
+ dispose();
+ }
+
+ void FinalPage::dispose()
+ {
delete m_pLocationController;
+ AddressBookSourcePage::dispose();
}
bool FinalPage::isValidName() const
diff --git a/extensions/source/abpilot/abpfinalpage.hxx b/extensions/source/abpilot/abpfinalpage.hxx
index 821f39f..65c40b3 100644
--- a/extensions/source/abpilot/abpfinalpage.hxx
+++ b/extensions/source/abpilot/abpfinalpage.hxx
@@ -53,6 +53,7 @@ namespace abp
public:
FinalPage( OAddessBookSourcePilot* _pParent );
virtual ~FinalPage();
+ virtual void dispose() SAL_OVERRIDE;
protected:
// OWizardPage overridables
diff --git a/extensions/source/abpilot/abspilot.cxx b/extensions/source/abpilot/abspilot.cxx
index 45abc6b..6cfda0b 100644
--- a/extensions/source/abpilot/abspilot.cxx
+++ b/extensions/source/abpilot/abspilot.cxx
@@ -130,11 +130,6 @@ namespace abp
SetHelpId(HID_ABSPILOT);
}
- OAddessBookSourcePilot::~OAddessBookSourcePilot()
- {
- }
-
-
OUString OAddessBookSourcePilot::getStateDisplayName( WizardState _nState ) const
{
sal_uInt16 nResId = 0;
diff --git a/extensions/source/abpilot/abspilot.hxx b/extensions/source/abpilot/abspilot.hxx
index cd4e818..5c67bc1 100644
--- a/extensions/source/abpilot/abspilot.hxx
+++ b/extensions/source/abpilot/abspilot.hxx
@@ -49,8 +49,6 @@ namespace abp
OAddessBookSourcePilot(
vcl::Window* _pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxORB);
- /// dtor
- virtual ~OAddessBookSourcePilot();
/// get the service factory which was used to create the dialog
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >&
diff --git a/extensions/source/abpilot/typeselectionpage.cxx b/extensions/source/abpilot/typeselectionpage.cxx
index 7936186..099ea23 100644
--- a/extensions/source/abpilot/typeselectionpage.cxx
+++ b/extensions/source/abpilot/typeselectionpage.cxx
@@ -151,11 +151,17 @@ namespace abp
TypeSelectionPage::~TypeSelectionPage()
{
+ dispose();
+ }
+
+ void TypeSelectionPage::dispose()
+ {
for ( ::std::vector< ButtonItem >::iterator loop = m_aAllTypes.begin();
loop != m_aAllTypes.end(); ++loop )
{
loop->m_bVisible = false;
}
+ AddressBookSourcePage::dispose();
}
diff --git a/extensions/source/abpilot/typeselectionpage.hxx b/extensions/source/abpilot/typeselectionpage.hxx
index 2e4437e..131d5ea 100644
--- a/extensions/source/abpilot/typeselectionpage.hxx
+++ b/extensions/source/abpilot/typeselectionpage.hxx
@@ -66,6 +66,7 @@ namespace abp
public:
TypeSelectionPage( OAddessBookSourcePilot* _pParent );
virtual ~TypeSelectionPage();
+ virtual void dispose() SAL_OVERRIDE;
// retrieves the currently selected type
AddressSourceType getSelectedType() const;
diff --git a/extensions/source/bibliography/bibbeam.cxx b/extensions/source/bibliography/bibbeam.cxx
index 72120f8..1a4713c 100644
--- a/extensions/source/bibliography/bibbeam.cxx
+++ b/extensions/source/bibliography/bibbeam.cxx
@@ -87,6 +87,7 @@ namespace bib
BibGridwin(vcl::Window* pParent, WinBits nStyle = WB_3DLOOK );
virtual ~BibGridwin();
+ virtual void dispose() SAL_OVERRIDE;
void createGridWin(const Reference< awt::XControlModel > & xDbForm);
void disposeGridWin();
@@ -107,9 +108,15 @@ namespace bib
BibGridwin::~BibGridwin()
{
+ dispose();
+ }
+
+ void BibGridwin::dispose()
+ {
RemoveFromTaskPaneList( this );
disposeGridWin();
+ vcl::Window::dispose();
}
void BibGridwin::Resize()
@@ -195,6 +202,11 @@ namespace bib
BibBeamer::~BibBeamer()
{
+ dispose();
+ }
+
+ void BibBeamer::dispose()
+ {
if ( isFormConnected() )
disconnectForm();
@@ -215,7 +227,7 @@ namespace bib
pDel->disposeGridWin();
delete pDel;
}
-
+ BibSplitWindow::dispose();
}
void BibBeamer::createToolBar()
diff --git a/extensions/source/bibliography/bibbeam.hxx b/extensions/source/bibliography/bibbeam.hxx
index bfecf43..980ebf8 100644
--- a/extensions/source/bibliography/bibbeam.hxx
+++ b/extensions/source/bibliography/bibbeam.hxx
@@ -72,6 +72,7 @@ namespace bib
BibBeamer(vcl::Window* pParent,BibDataManager* pDatMan, WinBits nStyle = WB_3DLOOK );
virtual ~BibBeamer();
+ virtual void dispose() SAL_OVERRIDE;
void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
diff --git a/extensions/source/bibliography/bibcont.cxx b/extensions/source/bibliography/bibcont.cxx
index 954700c..d13600c 100644
--- a/extensions/source/bibliography/bibcont.cxx
+++ b/extensions/source/bibliography/bibcont.cxx
@@ -56,20 +56,11 @@ BibSplitWindow::BibSplitWindow( vcl::Window* pParent, WinBits nStyle ) : SplitWi
{
}
-BibSplitWindow::~BibSplitWindow()
-{
-}
-
BibTabPage::BibTabPage( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription ) :
TabPage( pParent, rID, rUIXMLDescription ), BibShortCutHandler( this )
{
}
-BibTabPage::~BibTabPage()
-{
-}
-
-
using namespace osl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -94,12 +85,18 @@ BibWindowContainer::BibWindowContainer( vcl::Window* pParent, BibShortCutHandler
BibWindowContainer::~BibWindowContainer()
{
+ dispose();
+}
+
+void BibWindowContainer::dispose()
+{
if( pChild )
{
vcl::Window* pDel = GetChild();
pChild = NULL; // prevents GetFocus for child while deleting!
delete pDel;
}
+ vcl::Window::dispose();
}
void BibWindowContainer::Resize()
@@ -132,6 +129,11 @@ BibBookContainer::BibBookContainer(vcl::Window* pParent, WinBits nStyle):
BibBookContainer::~BibBookContainer()
{
+ dispose();
+}
+
+void BibBookContainer::dispose()
+{
if( xTopFrameRef.is() )
xTopFrameRef->dispose();
if( xBottomFrameRef.is() )
@@ -152,6 +154,7 @@ BibBookContainer::~BibBookContainer()
}
CloseBibModul( pBibMod );
+ BibSplitWindow::dispose();
}
void BibBookContainer::Split()
diff --git a/extensions/source/bibliography/bibcont.hxx b/extensions/source/bibliography/bibcont.hxx
index af6a788..9c26ca0 100644
--- a/extensions/source/bibliography/bibcont.hxx
+++ b/extensions/source/bibliography/bibcont.hxx
@@ -43,8 +43,9 @@ class BibWindowContainer : public BibWindow //Window
public:
BibWindowContainer( vcl::Window* pParent, BibShortCutHandler* pChild, WinBits nStyle = WB_3DLOOK);
virtual ~BibWindowContainer();
+ virtual void dispose() SAL_OVERRIDE;
- inline vcl::Window* GetChild();
+ inline vcl::Window* GetChild();
virtual void GetFocus() SAL_OVERRIDE;
@@ -55,7 +56,7 @@ class BibWindowContainer : public BibWindow //Window
inline vcl::Window* BibWindowContainer::GetChild()
{
- return pChild? pChild->GetWindow() : NULL;
+ return pChild ? pChild->GetWindow() : NULL;
}
@@ -86,6 +87,7 @@ class BibBookContainer: public BibSplitWindow
BibBookContainer(vcl::Window* pParent, WinBits nStyle = WB_3DLOOK );
virtual ~BibBookContainer();
+ virtual void dispose() SAL_OVERRIDE;
inline BibWindow* GetTopWin() {return pTopWin;}
inline BibWindow* GetBottomWin() {return pBottomWin;}
diff --git a/extensions/source/bibliography/bibshortcuthandler.hxx b/extensions/source/bibliography/bibshortcuthandler.hxx
index f8c87f3..f109aeb 100644
--- a/extensions/source/bibliography/bibshortcuthandler.hxx
+++ b/extensions/source/bibliography/bibshortcuthandler.hxx
@@ -63,14 +63,12 @@ class BibSplitWindow : public SplitWindow, public BibShortCutHandler
{
public:
BibSplitWindow( vcl::Window* pParent,WinBits nStyle = WB_3DLOOK);
- virtual ~BibSplitWindow();
};
class BibTabPage : public TabPage, public BibShortCutHandler
{
public:
BibTabPage( vcl::Window* pParent, const OString& rID, const OUString& rUIXMLDescription );
- virtual ~BibTabPage();
};
#endif
diff --git a/extensions/source/bibliography/bibview.cxx b/extensions/source/bibliography/bibview.cxx
index 2d715d0..1df8403 100644
--- a/extensions/source/bibliography/bibview.cxx
+++ b/extensions/source/bibliography/bibview.cxx
@@ -60,6 +60,11 @@ namespace bib
BibView::~BibView()
{
+ dispose();
+ }
+
+ void BibView::dispose()
+ {
BibGeneralPage* pGeneralPage = m_pGeneralPage;
m_pGeneralPage = NULL;
@@ -97,6 +102,7 @@ namespace bib
pGeneralPage->RemoveListeners();
m_xGeneralPage = NULL;
+ BibWindow::dispose();
}
void BibView::UpdatePages()
diff --git a/extensions/source/bibliography/bibview.hxx b/extensions/source/bibliography/bibview.hxx
index add53d7..6ab966d 100644
--- a/extensions/source/bibliography/bibview.hxx
+++ b/extensions/source/bibliography/bibview.hxx
@@ -61,6 +61,7 @@ namespace bib
public:
BibView( vcl::Window* _pParent, BibDataManager* _pDatMan, WinBits nStyle = WB_3DLOOK );
virtual ~BibView();
+ virtual void dispose() SAL_OVERRIDE;
void UpdatePages();
diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx
index 3829d4f..e63300c 100644
--- a/extensions/source/bibliography/general.cxx
+++ b/extensions/source/bibliography/general.cxx
@@ -364,12 +364,18 @@ BibGeneralPage::BibGeneralPage(vcl::Window* pParent, BibDataManager* pMan):
BibGeneralPage::~BibGeneralPage()
{
+ dispose();
+}
+
+void BibGeneralPage::dispose()
+{
if (pDatMan && xPosListener.is())
{
uno::Reference< sdbc::XRowSet > xRowSet(pDatMan->getForm(), UNO_QUERY);
if(xRowSet.is())
xRowSet->removeRowSetListener(xPosListener);
}
+ BibTabPage::dispose();
}
void BibGeneralPage::RemoveListeners()
diff --git a/extensions/source/bibliography/general.hxx b/extensions/source/bibliography/general.hxx
index 9e96c33..106f7f3 100644
--- a/extensions/source/bibliography/general.hxx
+++ b/extensions/source/bibliography/general.hxx
@@ -131,6 +131,7 @@ protected:
public:
BibGeneralPage(vcl::Window* pParent, BibDataManager* pDatMan);
virtual ~BibGeneralPage();
+ virtual void dispose() SAL_OVERRIDE;
inline const OUString& GetErrorString() const;
diff --git a/extensions/source/bibliography/toolbar.cxx b/extensions/source/bibliography/toolbar.cxx
index 66ed1ca..771cbdc 100644
--- a/extensions/source/bibliography/toolbar.cxx
+++ b/extensions/source/bibliography/toolbar.cxx
@@ -179,10 +179,10 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
ToolBox(pParent,BibResId(RID_BIB_TOOLBAR)),
aImgLst(BibResId( RID_TOOLBAR_IMGLIST )),
aBigImgLst(BibResId( RID_TOOLBAR_BIGIMGLIST )),
- aFtSource(this,WB_VCENTER),
- aLBSource(this,WB_DROPDOWN),
- aFtQuery(this,WB_VCENTER),
- aEdQuery(this),
+ aFtSource(new FixedText(this,WB_VCENTER)),
+ aLBSource(new ListBox(this,WB_DROPDOWN)),
+ aFtQuery(new FixedText(this,WB_VCENTER)),
+ aEdQuery(new Edit(this)),
nMenuId(0),
nSelMenuItem(0),
aLayoutManager( aLink ),
@@ -198,10 +198,10 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
SetOutStyle(TOOLBOX_STYLE_FLAT);
Size a2Size(GetOutputSizePixel());
a2Size.Width()=100;
- aLBSource.SetSizePixel(a2Size);
- aLBSource.SetDropDownLineCount(9);
- aLBSource.Show();
- aLBSource.SetSelectHdl(LINK( this, BibToolBar, SelHdl));
+ aLBSource->SetSizePixel(a2Size);
+ aLBSource->SetDropDownLineCount(9);
+ aLBSource->Show();
+ aLBSource->SetSelectHdl(LINK( this, BibToolBar, SelHdl));
SvtMiscOptions().AddListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
Application::AddEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
@@ -211,32 +211,42 @@ BibToolBar::BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle):
SetDropdownClickHdl( LINK( this, BibToolBar, MenuHdl));
- aEdQuery.SetSizePixel(aLBSource.GetSizePixel());
- aEdQuery.Show();
+ aEdQuery->SetSizePixel(aLBSource->GetSizePixel());
+ aEdQuery->Show();
OUString aStr=GetItemText(TBC_FT_SOURCE);
- aFtSource.SetText(aStr);
- aFtSource.SetSizePixel(aFtSource.get_preferred_size());
- aFtSource.SetBackground(Wallpaper( COL_TRANSPARENT ));
+ aFtSource->SetText(aStr);
+ aFtSource->SetSizePixel(aFtSource->get_preferred_size());
+ aFtSource->SetBackground(Wallpaper( COL_TRANSPARENT ));
aStr=GetItemText(TBC_FT_QUERY);
- aFtQuery.SetText(aStr);
- aFtQuery.SetSizePixel(aFtQuery.get_preferred_size());
- aFtQuery.SetBackground(Wallpaper( COL_TRANSPARENT ));
+ aFtQuery->SetText(aStr);
+ aFtQuery->SetSizePixel(aFtQuery->get_preferred_size());
+ aFtQuery->SetBackground(Wallpaper( COL_TRANSPARENT ));
- SetItemWindow(TBC_FT_SOURCE,&aFtSource);
- SetItemWindow(TBC_LB_SOURCE,&aLBSource);
- SetItemWindow(TBC_FT_QUERY ,&aFtQuery);
- SetItemWindow(TBC_ED_QUERY ,&aEdQuery);
+ SetItemWindow(TBC_FT_SOURCE, aFtSource.get());
+ SetItemWindow(TBC_LB_SOURCE, aLBSource.get());
+ SetItemWindow(TBC_FT_QUERY , aFtQuery.get());
+ SetItemWindow(TBC_ED_QUERY , aEdQuery.get());
::bib::AddToTaskPaneList( this );
}
BibToolBar::~BibToolBar()
{
+ dispose();
+}
+
+void BibToolBar::dispose()
+{
SvtMiscOptions().RemoveListenerLink( LINK( this, BibToolBar, OptionsChanged_Impl ) );
Application::RemoveEventListener( LINK( this, BibToolBar, SettingsChanged_Impl ) );
::bib::RemoveFromTaskPaneList( this );
+ aFtSource.disposeAndClear();
+ aFtQuery.disposeAndClear();
+ aEdQuery.disposeAndClear();
+ aLBSource.disposeAndClear();
+ ToolBox::dispose();
}
void BibToolBar::InitListener()
@@ -308,7 +318,7 @@ void BibToolBar::Select()
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name="QueryText";
- OUString aSelection = aEdQuery.GetText();
+ OUString aSelection = aEdQuery->GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name="QueryField";
@@ -386,39 +396,39 @@ void BibToolBar::SelectFilterItem(sal_uInt16 nId)
void BibToolBar::EnableSourceList(bool bFlag)
{
- aFtSource.Enable(bFlag);
- aLBSource.Enable(bFlag);
+ aFtSource->Enable(bFlag);
+ aLBSource->Enable(bFlag);
}
void BibToolBar::ClearSourceList()
{
- aLBSource.Clear();
+ aLBSource->Clear();
}
void BibToolBar::UpdateSourceList(bool bFlag)
{
- aLBSource.SetUpdateMode(bFlag);
+ aLBSource->SetUpdateMode(bFlag);
}
void BibToolBar::InsertSourceEntry(const OUString& aEntry, sal_Int32 nPos)
{
- aLBSource.InsertEntry(aEntry, nPos);
+ aLBSource->InsertEntry(aEntry, nPos);
}
void BibToolBar::SelectSourceEntry(const OUString& aStr)
{
- aLBSource.SelectEntry(aStr);
+ aLBSource->SelectEntry(aStr);
}
void BibToolBar::EnableQuery(bool bFlag)
{
- aFtQuery.Enable(bFlag);
- aEdQuery.Enable(bFlag);
+ aFtQuery->Enable(bFlag);
+ aEdQuery->Enable(bFlag);
}
void BibToolBar::SetQueryString(const OUString& aStr)
{
- aEdQuery.SetText(aStr);
+ aEdQuery->SetText(aStr);
}
@@ -427,7 +437,7 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
bool nResult = true;
MouseNotifyEvent nSwitch=rNEvt.GetType();
- if(aEdQuery.HasFocus() && nSwitch==MouseNotifyEvent::KEYINPUT)
+ if(aEdQuery->HasFocus() && nSwitch==MouseNotifyEvent::KEYINPUT)
{
const vcl::KeyCode& aKeyCode=rNEvt.GetKeyEvent()->GetKeyCode();
sal_uInt16 nKey = aKeyCode.GetCode();
@@ -436,7 +446,7 @@ bool BibToolBar::PreNotify( NotifyEvent& rNEvt )
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "QueryText";
- OUString aSelection = aEdQuery.GetText();
+ OUString aSelection = aEdQuery->GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name="QueryField";
pPropertyVal[1].Value <<= aQueryField;
@@ -462,7 +472,7 @@ IMPL_LINK( BibToolBar, SendSelHdl, Timer*,/*pT*/)
Sequence<PropertyValue> aPropVal(1);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "DataSourceName";
- OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource.GetSelectEntry() ) );
+ OUString aEntry( MnemonicGenerator::EraseAllMnemonicChars( aLBSource->GetSelectEntry() ) );
OUString aSelection = aEntry;
pPropertyVal[0].Value <<= aSelection;
SendDispatch(TBC_LB_SOURCE,aPropVal);
@@ -490,7 +500,7 @@ IMPL_LINK( BibToolBar, MenuHdl, ToolBox*, /*pToolbox*/)
Sequence<PropertyValue> aPropVal(2);
PropertyValue* pPropertyVal = const_cast<PropertyValue*>(aPropVal.getConstArray());
pPropertyVal[0].Name = "QueryText";
- OUString aSelection = aEdQuery.GetText();
+ OUString aSelection = aEdQuery->GetText();
pPropertyVal[0].Value <<= aSelection;
pPropertyVal[1].Name="QueryField";
pPropertyVal[1].Value <<= aQueryField;
diff --git a/extensions/source/bibliography/toolbar.hxx b/extensions/source/bibliography/toolbar.hxx
index 177fc0b..09e3074 100644
--- a/extensions/source/bibliography/toolbar.hxx
+++ b/extensions/source/bibliography/toolbar.hxx
@@ -109,20 +109,20 @@ class BibToolBar: public ToolBox
private:
BibToolBarListenerArr aListenerArr;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > xController;
+ css::uno::Reference< css::frame::XController > xController;
Idle aIdle;
ImageList aImgLst;
ImageList aImgLstHC;
ImageList aBigImgLst;
ImageList aBigImgLstHC;
- FixedText aFtSource;
- ListBox aLBSource;
- FixedText aFtQuery;
- Edit aEdQuery;
+ VclPtr<FixedText> aFtSource;
+ VclPtr<ListBox> aLBSource;
+ VclPtr<FixedText> aFtQuery;
+ VclPtr<Edit> aEdQuery;
PopupMenu aPopupMenu;
sal_uInt16 nMenuId;
sal_uInt16 nSelMenuItem;
- OUString aQueryField;
+ OUString aQueryField;
Link aLayoutManager;
sal_Int16 nSymbolsSize;
sal_Int16 nOutStyle;
@@ -150,6 +150,7 @@ class BibToolBar: public ToolBox
BibToolBar(vcl::Window* pParent, Link aLink, WinBits nStyle = WB_3DLOOK );
virtual ~BibToolBar();
+ virtual void dispose() SAL_OVERRIDE;
void SetXController(const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > &);
diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx
index bd0b335..069a406 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -55,7 +55,7 @@ namespace pcr
OBrowserLine::OBrowserLine( const OUString& _rEntryName, vcl::Window* pParent )
:m_sEntryName( _rEntryName )
- ,m_aFtTitle(pParent)
+ ,m_aFtTitle(new FixedText(pParent))
,m_pControlWindow( NULL )
,m_pBrowseButton(NULL)
,m_pAdditionalBrowseButton( NULL )
@@ -66,7 +66,7 @@ namespace pcr
,m_bIndentTitle( false )
,m_bReadOnly( false )
{
- m_aFtTitle.Show();
+ m_aFtTitle->Show();
}
@@ -123,7 +123,7 @@ namespace pcr
vcl::Window* OBrowserLine::GetRefWindow()
{
- vcl::Window* pRefWindow=&m_aFtTitle;
+ vcl::Window* pRefWindow = m_aFtTitle.get();
if(m_pBrowseButton)
{
@@ -139,7 +139,7 @@ namespace pcr
void OBrowserLine::SetTabOrder(vcl::Window* pRefWindow, sal_uInt16 nFlags )
{
- m_aFtTitle.SetZOrder(pRefWindow,nFlags);
+ m_aFtTitle->SetZOrder(pRefWindow,nFlags);
if ( m_pControlWindow )
m_pControlWindow->SetZOrder( (vcl::Window*)&m_aFtTitle, WINDOW_ZORDER_BEHIND );
@@ -185,7 +185,7 @@ namespace pcr
void OBrowserLine::Show(bool bFlag)
{
- m_aFtTitle.Show(bFlag);
+ m_aFtTitle->Show(bFlag);
if ( m_pControlWindow )
m_pControlWindow->Show( bFlag );
if ( m_pBrowseButton )
@@ -203,7 +203,7 @@ namespace pcr
bool OBrowserLine::IsVisible()
{
- return m_aFtTitle.IsVisible();
+ return m_aFtTitle->IsVisible();
}
@@ -219,7 +219,7 @@ namespace pcr
aTitlePos.X() += aIndent.Width();
aTitleSize.Width() -= aIndent.Width();
}
- m_aFtTitle.SetPosSizePixel( aTitlePos, aTitleSize );
+ m_aFtTitle->SetPosSizePixel( aTitlePos, aTitleSize );
}
sal_Int32 nBrowseButtonSize = m_aOutputSize.Height() - 4;
@@ -255,7 +255,7 @@ namespace pcr
if ( GetTitle() == _rNewTtile )
return;
// #99102# --------------
- m_aFtTitle.SetText( _rNewTtile );
+ m_aFtTitle->SetText( _rNewTtile );
if ( m_pControlWindow )
m_pControlWindow->SetAccessibleName( _rNewTtile );
if ( m_pBrowseButton )
@@ -268,7 +268,7 @@ namespace pcr
{
if( m_pTheParent )
{
- OUStringBuffer aText( m_aFtTitle.GetText() );
+ OUStringBuffer aText( m_aFtTitle->GetText() );
while( m_pTheParent->GetTextWidth( aText.toString() ) < m_nNameWidth )
aText.append("...........");
@@ -280,14 +280,14 @@ namespace pcr
aText.append( OUString(cRTL_mark) );
}
- m_aFtTitle.SetText( aText.makeStringAndClear() );
+ m_aFtTitle->SetText( aText.makeStringAndClear() );
}
}
OUString OBrowserLine::GetTitle() const
{
- OUString sDisplayName = m_aFtTitle.GetText();
+ OUString sDisplayName = m_aFtTitle->GetText();
// for Issue 69452
if (AllSettings::GetLayoutRTL())
@@ -341,7 +341,7 @@ namespace pcr
void OBrowserLine::implUpdateEnabledDisabled()
{
- implEnable( &m_aFtTitle, m_nEnableFlags, PropertyLineElement::CompleteLine );
+ implEnable( m_aFtTitle.get(), m_nEnableFlags, PropertyLineElement::CompleteLine );
if ( m_pControlWindow )
implEnable( m_pControlWindow, m_nEnableFlags, PropertyLineElement::CompleteLine | PropertyLineElement::InputControl );
diff --git a/extensions/source/propctrlr/browserline.hxx b/extensions/source/propctrlr/browserline.hxx
index cdc91c7..ff16ae9 100644
--- a/extensions/source/propctrlr/browserline.hxx
+++ b/extensions/source/propctrlr/browserline.hxx
@@ -50,17 +50,17 @@ namespace pcr
class OBrowserLine
{
private:
- OUString m_sEntryName;
- FixedText m_aFtTitle;
+ OUString m_sEntryName;
+ VclPtr<FixedText> m_aFtTitle;
Size m_aOutputSize;
Point m_aLinePos;
::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
m_xControl;
- vcl::Window* m_pControlWindow;
+ vcl::Window* m_pControlWindow;
PushButton* m_pBrowseButton;
PushButton* m_pAdditionalBrowseButton;
IButtonClickListener* m_pClickListener;
- vcl::Window* m_pTheParent;
+ vcl::Window* m_pTheParent;
sal_uInt16 m_nNameWidth;
sal_uInt16 m_nEnableFlags;
bool m_bIndentTitle;
diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index 568a4cb..6bb08b0 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -345,8 +345,8 @@ namespace pcr
OBrowserListBox::OBrowserListBox( vcl::Window* pParent, WinBits nWinStyle)
:Control(pParent, nWinStyle| WB_CLIPCHILDREN)
- ,m_aLinesPlayground(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN)
- ,m_aVScroll(this,WB_VSCROLL|WB_REPEAT|WB_DRAG)
+ ,m_aLinesPlayground(new vcl::Window(this,WB_DIALOGCONTROL | WB_CLIPCHILDREN))
+ ,m_aVScroll(new ScrollBar(this,WB_VSCROLL|WB_REPEAT|WB_DRAG))
,m_pHelpWindow( new InspectorHelpWindow( this ) )
,m_pLineListener(NULL)
,m_pControlObserver( NULL )
@@ -362,18 +362,23 @@ namespace pcr
aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
m_nRowHeight = aListBox.GetSizePixel().Height()+2;
SetBackground( pParent->GetBackground() );
- m_aLinesPlayground.SetBackground( GetBackground() );
+ m_aLinesPlayground->SetBackground( GetBackground() );
- m_aLinesPlayground.SetPosPixel(Point(0,0));
- m_aLinesPlayground.SetPaintTransparent(true);
- m_aLinesPlayground.Show();
- m_aVScroll.Hide();
- m_aVScroll.SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl));
+ m_aLinesPlayground->SetPosPixel(Point(0,0));
+ m_aLinesPlayground->SetPaintTransparent(true);
+ m_aLinesPlayground->Show();
+ m_aVScroll->Hide();
+ m_aVScroll->SetScrollHdl(LINK(this, OBrowserListBox, ScrollHdl));
}
OBrowserListBox::~OBrowserListBox()
{
+ dispose();
+ }
+
+ void OBrowserListBox::dispose()
+ {
OSL_ENSURE( !IsModified(), "OBrowserListBox::~OBrowserListBox: still modified - should have been committed before!" );
// doing the commit here, while we, as well as our owner, as well as some other components,
// are already "half dead" (means within their dtor) is potentially dangerous.
@@ -384,7 +389,9 @@ namespace pcr
Hide();
Clear();
-
+ m_aLinesPlayground.disposeAndClear();
+ m_aVScroll.disposeAndClear();
+ Control::dispose();
}
@@ -425,7 +432,7 @@ namespace pcr
if (m_bIsActive)
{
// TODO: what's the sense of this?
- m_aVScroll.SetThumbPos(100);
+ m_aVScroll->SetThumbPos(100);
MoveThumbTo(0);
Resize();
}
@@ -452,31 +459,31 @@ namespace pcr
aLinesArea.Bottom() -= nHelpWindowHeight;
aLinesArea.Bottom() -= aHelpWindowDistance.Height();
}
- m_aLinesPlayground.SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
+ m_aLinesPlayground->SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
UpdateVScroll();
bool bNeedScrollbar = m_aLines.size() > (sal_uInt32)CalcVisibleLines();
if ( !bNeedScrollbar )
{
- if ( m_aVScroll.IsVisible() )
- m_aVScroll.Hide();
+ if ( m_aVScroll->IsVisible() )
+ m_aVScroll->Hide();
// scroll to top
m_nYOffset = 0;
- m_aVScroll.SetThumbPos( 0 );
+ m_aVScroll->SetThumbPos( 0 );
}
else
{
- Size aVScrollSize( m_aVScroll.GetSizePixel() );
+ Size aVScrollSize( m_aVScroll->GetSizePixel() );
// adjust the playground's width
aLinesArea.Right() -= aVScrollSize.Width();
- m_aLinesPlayground.SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
+ m_aLinesPlayground->SetPosSizePixel( aLinesArea.TopLeft(), aLinesArea.GetSize() );
// position the scrollbar
aVScrollSize.Height() = aLinesArea.GetHeight();
Point aVScrollPos( aLinesArea.GetWidth(), 0 );
- m_aVScroll.SetPosSizePixel( aVScrollPos, aVScrollSize );
+ m_aVScroll->SetPosSizePixel( aVScrollPos, aVScrollSize );
}
for ( sal_uInt16 i = 0; i < m_aLines.size(); ++i )
@@ -489,7 +496,7 @@ namespace pcr
// show the scrollbar
if ( bNeedScrollbar )
- m_aVScroll.Show();
+ m_aVScroll->Show();
// position the help window
if ( bPositionHelpWindow )
@@ -543,7 +550,7 @@ namespace pcr
sal_uInt16 OBrowserListBox::CalcVisibleLines()
{
- Size aSize(m_aLinesPlayground.GetOutputSizePixel());
+ Size aSize(m_aLinesPlayground->GetOutputSizePixel());
sal_uInt16 nResult = 0;
if (0 != m_nRowHeight)
nResult = (sal_uInt16) aSize.Height()/m_nRowHeight;
@@ -555,18 +562,18 @@ namespace pcr
void OBrowserListBox::UpdateVScroll()
{
sal_uInt16 nLines = CalcVisibleLines();
- m_aVScroll.SetPageSize(nLines-1);
- m_aVScroll.SetVisibleSize(nLines-1);
+ m_aVScroll->SetPageSize(nLines-1);
+ m_aVScroll->SetVisibleSize(nLines-1);
size_t nCount = m_aLines.size();
if (nCount>0)
{
- m_aVScroll.SetRange(Range(0,nCount-1));
- m_nYOffset = -m_aVScroll.GetThumbPos()*m_nRowHeight;
+ m_aVScroll->SetRange(Range(0,nCount-1));
+ m_nYOffset = -m_aVScroll->GetThumbPos()*m_nRowHeight;
}
else
{
- m_aVScroll.SetRange(Range(0,0));
+ m_aVScroll->SetRange(Range(0,0));
m_nYOffset = 0;
}
}
@@ -574,7 +581,7 @@ namespace pcr
void OBrowserListBox::PositionLine( sal_uInt16 _nIndex )
{
- Size aSize(m_aLinesPlayground.GetOutputSizePixel());
+ Size aSize(m_aLinesPlayground->GetOutputSizePixel());
Point aPos(0, m_nYOffset);
aSize.Height() = m_nRowHeight;
@@ -612,7 +619,7 @@ namespace pcr
void OBrowserListBox::UpdatePlayGround()
{
- sal_Int32 nThumbPos = m_aVScroll.GetThumbPos();
+ sal_Int32 nThumbPos = m_aVScroll->GetThumbPos();
sal_Int32 nLines = CalcVisibleLines();
sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + nLines);
@@ -729,7 +736,7 @@ namespace pcr
sal_uInt16 OBrowserListBox::InsertEntry(const OLineDescriptor& _rPropertyData, sal_uInt16 _nPos)
{
// create a new line
- BrowserLinePointer pBrowserLine( new OBrowserLine( _rPropertyData.sName, &m_aLinesPlayground ) );
+ BrowserLinePointer pBrowserLine( new OBrowserLine( _rPropertyData.sName, m_aLinesPlayground.get() ) );
// check that the name is unique
ListBoxLines::iterator it = m_aLines.begin();
@@ -794,7 +801,7 @@ namespace pcr
{
if ( _nPos < m_aLines.size() )
{
- sal_Int32 nThumbPos = m_aVScroll.GetThumbPos();
+ sal_Int32 nThumbPos = m_aVScroll->GetThumbPos();
if (_nPos < nThumbPos)
MoveThumbTo(_nPos);
@@ -812,19 +819,19 @@ namespace pcr
void OBrowserListBox::MoveThumbTo(sal_Int32 _nNewThumbPos)
{
// disable painting to prevent flicker
- m_aLinesPlayground.EnablePaint(false);
+ m_aLinesPlayground->EnablePaint(false);
- sal_Int32 nDelta = _nNewThumbPos - m_aVScroll.GetThumbPos();
+ sal_Int32 nDelta = _nNewThumbPos - m_aVScroll->GetThumbPos();
// adjust the scrollbar
- m_aVScroll.SetThumbPos(_nNewThumbPos);
+ m_aVScroll->SetThumbPos(_nNewThumbPos);
sal_Int32 nThumbPos = _nNewThumbPos;
- m_nYOffset = -m_aVScroll.GetThumbPos() * m_nRowHeight;
+ m_nYOffset = -m_aVScroll->GetThumbPos() * m_nRowHeight;
sal_Int32 nLines = CalcVisibleLines();
sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + nLines);
- m_aLinesPlayground.Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
+ m_aLinesPlayground->Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
if (1 == nDelta)
{
@@ -841,27 +848,27 @@ namespace pcr
UpdatePlayGround();
}
- m_aLinesPlayground.EnablePaint(true);
- m_aLinesPlayground.Invalidate(INVALIDATE_CHILDREN);
+ m_aLinesPlayground->EnablePaint(true);
+ m_aLinesPlayground->Invalidate(INVALIDATE_CHILDREN);
}
IMPL_LINK(OBrowserListBox, ScrollHdl, ScrollBar*, _pScrollBar )
{
- DBG_ASSERT(_pScrollBar == &m_aVScroll, "OBrowserListBox::ScrollHdl: where does this come from?");
+ DBG_ASSERT(_pScrollBar == m_aVScroll.get(), "OBrowserListBox::ScrollHdl: where does this come from?");
(void)_pScrollBar;
// disable painting to prevent flicker
- m_aLinesPlayground.EnablePaint(false);
+ m_aLinesPlayground->EnablePaint(false);
- sal_Int32 nThumbPos = m_aVScroll.GetThumbPos();
+ sal_Int32 nThumbPos = m_aVScroll->GetThumbPos();
- sal_Int32 nDelta = m_aVScroll.GetDelta();
+ sal_Int32 nDelta = m_aVScroll->GetDelta();
m_nYOffset = -nThumbPos * m_nRowHeight;
sal_uInt16 nEnd = (sal_uInt16)(nThumbPos + CalcVisibleLines());
- m_aLinesPlayground.Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
+ m_aLinesPlayground->Scroll(0, -nDelta * m_nRowHeight, SCROLL_CHILDREN);
if (1 == nDelta)
{
@@ -872,12 +879,12 @@ namespace pcr
{
PositionLine((sal_uInt16)nThumbPos);
}
- else if (nDelta!=0 || m_aVScroll.GetType() == SCROLL_DONTKNOW)
+ else if (nDelta!=0 || m_aVScroll->GetType() == SCROLL_DONTKNOW)
{
UpdatePlayGround();
}
- m_aLinesPlayground.EnablePaint(true);
+ m_aLinesPlayground->EnablePaint(true);
return 0;
}
@@ -1129,7 +1136,7 @@ namespace pcr
rLine.pLine->SetTitle(_rPropertyData.DisplayName);
rLine.xHandler = _rPropertyData.xPropertyHandler;
- sal_uInt16 nTextWidth = (sal_uInt16)m_aLinesPlayground.GetTextWidth(_rPropertyData.DisplayName);
+ sal_uInt16 nTextWidth = (sal_uInt16)m_aLinesPlayground->GetTextWidth(_rPropertyData.DisplayName);
if (m_nTheNameSize< nTextWidth)
m_nTheNameSize = nTextWidth;
@@ -1216,21 +1223,21 @@ namespace pcr
break;
long nScrollOffset = 0;
- if ( m_aVScroll.IsVisible() )
+ if ( m_aVScroll->IsVisible() )
{
if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEUP )
- nScrollOffset = -m_aVScroll.GetPageSize();
+ nScrollOffset = -m_aVScroll->GetPageSize();
else if ( pKeyEvent->GetKeyCode().GetCode() == KEY_PAGEDOWN )
- nScrollOffset = m_aVScroll.GetPageSize();
+ nScrollOffset = m_aVScroll->GetPageSize();
}
if ( nScrollOffset )
{
- long nNewThumbPos = m_aVScroll.GetThumbPos() + nScrollOffset;
- nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll.GetRangeMin() );
- nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll.GetRangeMax() );
- m_aVScroll.DoScroll( nNewThumbPos );
- nNewThumbPos = m_aVScroll.GetThumbPos();
+ long nNewThumbPos = m_aVScroll->GetThumbPos() + nScrollOffset;
+ nNewThumbPos = ::std::max( nNewThumbPos, m_aVScroll->GetRangeMin() );
+ nNewThumbPos = ::std::min( nNewThumbPos, m_aVScroll->GetRangeMax() );
+ m_aVScroll->DoScroll( nNewThumbPos );
+ nNewThumbPos = m_aVScroll->GetThumbPos();
sal_uInt16 nFocusControlPos = 0;
sal_uInt16 nActiveControlPos = impl_getControlPos( m_xActiveControl );
@@ -1271,9 +1278,9 @@ namespace pcr
)
{
// interested in scroll events if we have a scrollbar
- if ( m_aVScroll.IsVisible() )
+ if ( m_aVScroll->IsVisible() )
{
- HandleScrollCommand( *pCommand, NULL, &m_aVScroll );
+ HandleScrollCommand( *pCommand, NULL, m_aVScroll.get() );
}
}
}
diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx
index 839c8b5..a1ea459 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -93,8 +93,8 @@ namespace pcr
,public PcrClient
{
protected:
- Window m_aLinesPlayground;
- ScrollBar m_aVScroll;
+ VclPtr<Window> m_aLinesPlayground;
+ VclPtr<ScrollBar> m_aVScroll;
::std::unique_ptr< InspectorHelpWindow >
m_pHelpWindow;
ListBoxLines m_aLines;
@@ -125,6 +125,7 @@ namespace pcr
OBrowserListBox( vcl::Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL );
virtual ~OBrowserListBox();
+ virtual void dispose() SAL_OVERRIDE;
void UpdateAll();
diff --git a/extensions/source/propctrlr/browserpage.cxx b/extensions/source/propctrlr/browserpage.cxx
index 2e733a9..2dc6ef6 100644
--- a/extensions/source/propctrlr/browserpage.cxx
+++ b/extensions/source/propctrlr/browserpage.cxx
@@ -35,25 +35,31 @@ namespace pcr
OBrowserPage::OBrowserPage(vcl::Window* pParent,WinBits nWinStyle)
:TabPage(pParent,nWinStyle)
- ,m_aListBox(this)
+ ,m_aListBox(new OBrowserListBox(this))
{
- m_aListBox.SetBackground(GetBackground());
- m_aListBox.SetPaintTransparent( true );
- m_aListBox.Show();
+ m_aListBox->SetBackground(GetBackground());
+ m_aListBox->SetPaintTransparent( true );
+ m_aListBox->Show();
}
OBrowserPage::~OBrowserPage()
{
+ dispose();
}
+ void OBrowserPage::dispose()
+ {
+ m_aListBox.disposeAndClear();
+ TabPage::dispose();
+ }
void OBrowserPage::Resize()
{
Size aSize( GetOutputSizePixel() );
aSize.Width() -= LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT;
aSize.Height() -= LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM;
- m_aListBox.SetPosSizePixel( Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ), aSize );
+ m_aListBox->SetPosSizePixel( Point( LAYOUT_BORDER_LEFT, LAYOUT_BORDER_TOP ), aSize );
}
@@ -65,19 +71,19 @@ namespace pcr
{
Window::StateChanged( nType);
if (StateChangedType::VISIBLE == nType)
- m_aListBox.ActivateListBox(IsVisible());
+ m_aListBox->ActivateListBox(IsVisible());
}
sal_Int32 OBrowserPage::getMinimumWidth()
{
- return m_aListBox.GetMinimumWidth() + LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT;
+ return m_aListBox->GetMinimumWidth() + LAYOUT_BORDER_LEFT + LAYOUT_BORDER_RIGHT;
}
sal_Int32 OBrowserPage::getMinimumHeight()
{
- return m_aListBox.GetMinimumHeight() + LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM;
+ return m_aListBox->GetMinimumHeight() + LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM;
}
diff --git a/extensions/source/propctrlr/browserpage.hxx b/extensions/source/propctrlr/browserpage.hxx
index 6ef6ef8..8ce0b50 100644
--- a/extensions/source/propctrlr/browserpage.hxx
+++ b/extensions/source/propctrlr/browserpage.hxx
@@ -34,7 +34,7 @@ namespace pcr
class OBrowserPage : public TabPage
{
private:
- OBrowserListBox m_aListBox;
+ VclPtr<OBrowserListBox> m_aListBox;
protected:
virtual void Resize() SAL_OVERRIDE;
@@ -43,12 +43,13 @@ namespace pcr
public:
OBrowserPage(vcl::Window* pParent, WinBits nWinStyle = 0);
virtual ~OBrowserPage();
+ virtual void dispose() SAL_OVERRIDE;
sal_Int32 getMinimumWidth();
sal_Int32 getMinimumHeight();
- OBrowserListBox& getListBox() { return m_aListBox; }
- const OBrowserListBox& getListBox() const { return m_aListBox; }
+ OBrowserListBox& getListBox() { return *m_aListBox.get(); }
+ const OBrowserListBox& getListBox() const { return *m_aListBox.get(); }
};
diff --git a/extensions/source/propctrlr/browserview.cxx b/extensions/source/propctrlr/browserview.cxx
index 4179cbe..7a39ac9 100644
--- a/extensions/source/propctrlr/browserview.cxx
+++ b/extensions/source/propctrlr/browserview.cxx
@@ -53,6 +53,11 @@ namespace pcr
OPropertyBrowserView::~OPropertyBrowserView()
{
+ dispose();
+ }
+
+ void OPropertyBrowserView::dispose()
+ {
if(m_pPropBox)
{
sal_uInt16 nTmpPage = m_pPropBox->GetCurPage();
@@ -61,7 +66,7 @@ namespace pcr
boost::scoped_ptr<vcl::Window> aTemp(m_pPropBox);
m_pPropBox = NULL;
}
-
+ vcl::Window::dispose();
}
diff --git a/extensions/source/propctrlr/browserview.hxx b/extensions/source/propctrlr/browserview.hxx
index c87dd55..249d87c 100644
--- a/extensions/source/propctrlr/browserview.hxx
+++ b/extensions/source/propctrlr/browserview.hxx
@@ -50,6 +50,7 @@ namespace pcr
OPropertyBrowserView( vcl::Window* pParent, WinBits nBits = 0);
virtual ~OPropertyBrowserView();
+ virtual void dispose() SAL_OVERRIDE;
OPropertyEditor& getPropertyBox() { return *m_pPropBox; }
diff --git a/extensions/source/propctrlr/inspectorhelpwindow.cxx b/extensions/source/propctrlr/inspectorhelpwindow.cxx
index b62010c..822b9e6 100644
--- a/extensions/source/propctrlr/inspectorhelpwindow.cxx
+++ b/extensions/source/propctrlr/inspectorhelpwindow.cxx
@@ -29,27 +29,38 @@ namespace pcr
InspectorHelpWindow::InspectorHelpWindow( vcl::Window* _pParent )
:Window( _pParent, WB_DIALOGCONTROL )
- ,m_aSeparator( this )
- ,m_aHelpText( this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL )
+ ,m_aSeparator( new FixedLine(this) )
+ ,m_aHelpText( new MultiLineEdit(this, WB_LEFT | WB_READONLY | WB_AUTOVSCROLL) )
,m_nMinLines( 3 )
,m_nMaxLines( 8 )
{
SetBackground();
SetPaintTransparent(true);
- m_aSeparator.SetText( PcrRes(RID_STR_HELP_SECTION_LABEL).toString() );
- m_aSeparator.SetBackground();
- m_aSeparator.Show();
-
- m_aHelpText.SetControlBackground( /*m_aSeparator.GetBackground().GetColor() */);
- m_aHelpText.SetBackground();
- m_aHelpText.SetPaintTransparent(true);
- m_aHelpText.Show();
+ m_aSeparator->SetText( PcrRes(RID_STR_HELP_SECTION_LABEL).toString() );
+ m_aSeparator->SetBackground();
+ m_aSeparator->Show();
+
+ m_aHelpText->SetControlBackground( /*m_aSeparator->GetBackground().GetColor() */);
+ m_aHelpText->SetBackground();
+ m_aHelpText->SetPaintTransparent(true);
+ m_aHelpText->Show();
}
+ InspectorHelpWindow::~InspectorHelpWindow()
+ {
+ dispose();
+ }
+
+ void InspectorHelpWindow::dispose()
+ {
+ m_aSeparator.disposeAndClear();
+ m_aHelpText.disposeAndClear();
+ vcl::Window::dispose();
+ }
void InspectorHelpWindow::SetText( const OUString& _rStr )
{
- m_aHelpText.SetText( _rStr );
+ m_aHelpText->SetText( _rStr );
}
@@ -63,7 +74,7 @@ namespace pcr
long InspectorHelpWindow::impl_getHelpTextBorderHeight()
{
sal_Int32 nTop(0), nBottom(0), nDummy(0);
- m_aHelpText.GetBorder( nDummy, nTop, nDummy, nBottom );
+ m_aHelpText->GetBorder( nDummy, nTop, nDummy, nBottom );
return nTop + nBottom;
}
@@ -84,13 +95,13 @@ namespace pcr
long InspectorHelpWindow::impl_getMinimalTextWindowHeight()
{
- return impl_getHelpTextBorderHeight() + m_aHelpText.GetTextHeight() * m_nMinLines;
+ return impl_getHelpTextBorderHeight() + m_aHelpText->GetTextHeight() * m_nMinLines;
}
long InspectorHelpWindow::impl_getMaximalTextWindowHeight()
{
- return impl_getHelpTextBorderHeight() + m_aHelpText.GetTextHeight() * m_nMaxLines;
+ return impl_getHelpTextBorderHeight() + m_aHelpText->GetTextHeight() * m_nMaxLines;
}
@@ -100,8 +111,8 @@ namespace pcr
long nMinTextWindowHeight = impl_getMinimalTextWindowHeight();
long nMaxTextWindowHeight = impl_getMaximalTextWindowHeight();
- Rectangle aTextRect( Point( 0, 0 ), m_aHelpText.GetOutputSizePixel() );
- aTextRect = m_aHelpText.GetTextRect( aTextRect, m_aHelpText.GetText(),
+ Rectangle aTextRect( Point( 0, 0 ), m_aHelpText->GetOutputSizePixel() );
+ aTextRect = m_aHelpText->GetTextRect( aTextRect, m_aHelpText->GetText(),
TEXT_DRAW_LEFT | TEXT_DRAW_TOP | TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
long nActTextWindowHeight = impl_getHelpTextBorderHeight() + aTextRect.GetHeight();
@@ -120,11 +131,11 @@ namespace pcr
Rectangle aSeparatorArea( aPlayground );
aSeparatorArea.Bottom() = aSeparatorArea.Top() + LogicToPixel( Size( 0, 8 ), MAP_APPFONT ).Height();
- m_aSeparator.SetPosSizePixel( aSeparatorArea.TopLeft(), aSeparatorArea.GetSize() );
+ m_aSeparator->SetPosSizePixel( aSeparatorArea.TopLeft(), aSeparatorArea.GetSize() );
Rectangle aTextArea( aPlayground );
aTextArea.Top() = aSeparatorArea.Bottom() + a3AppFont.Height();
- m_aHelpText.SetPosSizePixel( aTextArea.TopLeft(), aTextArea.GetSize() );
+ m_aHelpText->SetPosSizePixel( aTextArea.TopLeft(), aTextArea.GetSize() );
}
diff --git a/extensions/source/propctrlr/inspectorhelpwindow.hxx b/extensions/source/propctrlr/inspectorhelpwindow.hxx
index 9419a72..0159cff 100644
--- a/extensions/source/propctrlr/inspectorhelpwindow.hxx
+++ b/extensions/source/propctrlr/inspectorhelpwindow.hxx
@@ -33,14 +33,16 @@ namespace pcr
class InspectorHelpWindow : public vcl::Window
{
private:
- FixedLine m_aSeparator;
- MultiLineEdit m_aHelpText;
+ VclPtr<FixedLine> m_aSeparator;
+ VclPtr<MultiLineEdit> m_aHelpText;
sal_Int32 m_nMinLines;
sal_Int32 m_nMaxLines;
public:
InspectorHelpWindow( vcl::Window* _pParent );
+ virtual ~InspectorHelpWindow();
+ virtual void dispose() SAL_OVERRIDE;
virtual void SetText( const OUString& rStr ) SAL_OVERRIDE;
diff --git a/extensions/source/propctrlr/propertyeditor.cxx b/extensions/source/propctrlr/propertyeditor.cxx
index 4a87e12..45a59b2 100644
--- a/extensions/source/propctrlr/propertyeditor.cxx
+++ b/extensions/source/propctrlr/propertyeditor.cxx
@@ -43,7 +43,7 @@ namespace pcr
OPropertyEditor::OPropertyEditor( vcl::Window* pParent, WinBits nWinStyle)
:Control(pParent, nWinStyle)
- ,m_aTabControl( this )
+ ,m_aTabControl( new TabControl(this) )
,m_pListener(NULL)
,m_pObserver(NULL)
,m_nNextId(1)
@@ -52,37 +52,44 @@ namespace pcr
,m_nMaxHelpLines( 0 )
{
- m_aTabControl.Show();
- m_aTabControl.SetDeactivatePageHdl(LINK(this, OPropertyEditor, OnPageDeactivate));
- m_aTabControl.SetActivatePageHdl(LINK(this, OPropertyEditor, OnPageActivate));
- m_aTabControl.SetBackground(GetBackground());
- m_aTabControl.SetPaintTransparent(true);
+ m_aTabControl->Show();
+ m_aTabControl->SetDeactivatePageHdl(LINK(this, OPropertyEditor, OnPageDeactivate));
+ m_aTabControl->SetActivatePageHdl(LINK(this, OPropertyEditor, OnPageActivate));
+ m_aTabControl->SetBackground(GetBackground());
+ m_aTabControl->SetPaintTransparent(true);
}
OPropertyEditor::~OPropertyEditor()
{
+ dispose();
+ }
+
+ void OPropertyEditor::dispose()
+ {
Hide();
ClearAll();
+ m_aTabControl.disposeAndClear();
+ Control::dispose();
}
void OPropertyEditor::ClearAll()
{
m_nNextId=1;
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for(long i = nCount-1; i >= 0; --i)
{
- sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i);
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ sal_uInt16 nID = m_aTabControl->GetPageId((sal_uInt16)i);
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
{
pPage->EnableInput(false);
- m_aTabControl.RemovePage(nID);
+ m_aTabControl->RemovePage(nID);
delete pPage;
}
}
- m_aTabControl.Clear();
+ m_aTabControl->Clear();
{
MapStringToPageId aEmpty;
@@ -101,16 +108,16 @@ namespace pcr
{
sal_Int32 nMinHeight( LAYOUT_BORDER_TOP + LAYOUT_BORDER_BOTTOM );
- if ( m_aTabControl.GetPageCount() > 0 )
+ if ( m_aTabControl->GetPageCount() > 0 )
{
- sal_uInt16 nFirstID = m_aTabControl.GetPageId( 0 );
+ sal_uInt16 nFirstID = m_aTabControl->GetPageId( 0 );
// reserve space for the tabs themself
- Rectangle aTabArea( m_aTabControl.GetTabBounds( nFirstID ) );
+ Rectangle aTabArea( m_aTabControl->GetTabBounds( nFirstID ) );
nMinHeight += aTabArea.GetHeight();
// ask the page how much it requires
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nFirstID ) );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nFirstID ) );
if ( pPage )
nMinHeight += pPage->getMinimumHeight();
}
@@ -123,12 +130,12 @@ namespace pcr
sal_Int32 OPropertyEditor::getMinimumWidth()
{
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
sal_Int32 nPageMinWidth = 0;
for(long i = nCount-1; i >= 0; --i)
{
- sal_uInt16 nID = m_aTabControl.GetPageId((sal_uInt16)i);
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ sal_uInt16 nID = m_aTabControl->GetPageId((sal_uInt16)i);
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
{
sal_Int32 nCurPageMinWidth = pPage->getMinimumWidth();
@@ -144,11 +151,11 @@ namespace pcr
{
// commit all of my pages, if necessary
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- sal_uInt16 nID = m_aTabControl.GetPageId( i );
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
+ sal_uInt16 nID = m_aTabControl->GetPageId( i );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nID ) );
if ( pPage && pPage->getListBox().IsModified() )
pPage->getListBox().CommitModified();
@@ -158,7 +165,7 @@ namespace pcr
void OPropertyEditor::GetFocus()
{
- m_aTabControl.GrabFocus();
+ m_aTabControl->GrabFocus();
}
@@ -167,7 +174,7 @@ namespace pcr
OBrowserPage* pPage = NULL;
MapStringToPageId::const_iterator aPropertyPageIdPos = m_aPropertyPageIds.find( _rPropertyName );
if ( aPropertyPageIdPos != m_aPropertyPageIds.end() )
- pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( aPropertyPageIdPos->second ) );
+ pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( aPropertyPageIdPos->second ) );
return pPage;
}
@@ -180,7 +187,7 @@ namespace pcr
OBrowserPage* OPropertyEditor::getPage( sal_uInt16& _rPageId )
{
- return static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( _rPageId ) );
+ return static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( _rPageId ) );
}
@@ -201,7 +208,7 @@ namespace pcr
);
Rectangle aTabArea( aPlayground );
- m_aTabControl.SetPosSizePixel( aTabArea.TopLeft(), aTabArea.GetSize() );
+ m_aTabControl->SetPosSizePixel( aTabArea.TopLeft(), aTabArea.GetSize() );
}
@@ -210,13 +217,13 @@ namespace pcr
// obtain a new id
sal_uInt16 nId = m_nNextId++;
// insert the id
- m_aTabControl.InsertPage(nId, _rText);
+ m_aTabControl->InsertPage(nId, _rText);
// create a new page
- OBrowserPage* pPage = new OBrowserPage(&m_aTabControl);
+ OBrowserPage* pPage = new OBrowserPage(m_aTabControl.get());
pPage->SetText( _rText );
// some knittings
- pPage->SetSizePixel(m_aTabControl.GetTabPageSizePixel());
+ pPage->SetSizePixel(m_aTabControl->GetTabPageSizePixel());
pPage->getListBox().SetListener(m_pListener);
pPage->getListBox().SetObserver(m_pObserver);
pPage->getListBox().EnableHelpSection( m_bHasHelpSection );
@@ -224,8 +231,8 @@ namespace pcr
pPage->SetHelpId( _rHelpId );
// immediately activate the page
- m_aTabControl.SetTabPage(nId, pPage);
- m_aTabControl.SetCurPageId(nId);
+ m_aTabControl->SetTabPage(nId, pPage);
+ m_aTabControl->SetCurPageId(nId);
return nId;
}
@@ -234,17 +241,17 @@ namespace pcr
void OPropertyEditor::SetHelpId( const OString& rHelpId )
{
Control::SetHelpId("");
- m_aTabControl.SetHelpId(rHelpId);
+ m_aTabControl->SetHelpId(rHelpId);
}
void OPropertyEditor::RemovePage(sal_uInt16 nID)
{
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
pPage->EnableInput(false);
- m_aTabControl.RemovePage(nID);
+ m_aTabControl->RemovePage(nID);
if (pPage)
delete pPage;
}
@@ -252,14 +259,14 @@ namespace pcr
void OPropertyEditor::SetPage(sal_uInt16 nId)
{
- m_aTabControl.SetCurPageId(nId);
+ m_aTabControl->SetCurPageId(nId);
}
sal_uInt16 OPropertyEditor::GetCurPage()
{
- if(m_aTabControl.GetPageCount()>0)
- return m_aTabControl.GetCurPageId();
+ if(m_aTabControl->GetPageCount()>0)
+ return m_aTabControl->GetCurPageId();
else
return 0;
}
@@ -268,11 +275,11 @@ namespace pcr
void OPropertyEditor::Update(const ::std::mem_fun_t<void,OBrowserListBox>& _aUpdateFunction)
{
// forward this to all our pages
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for (sal_uInt16 i=0;i<nCount;++i)
{
- sal_uInt16 nID = m_aTabControl.GetPageId(i);
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(nID));
+ sal_uInt16 nID = m_aTabControl->GetPageId(i);
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(nID));
if (pPage)
_aUpdateFunction(&pPage->getListBox());
}
@@ -291,11 +298,11 @@ namespace pcr
void OPropertyEditor::forEachPage( PageOperation _pOperation, const void* _pArgument )
{
- sal_uInt16 nCount = m_aTabControl.GetPageCount();
+ sal_uInt16 nCount = m_aTabControl->GetPageCount();
for ( sal_uInt16 i=0; i<nCount; ++i )
{
- sal_uInt16 nID = m_aTabControl.GetPageId(i);
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( nID ) );
+ sal_uInt16 nID = m_aTabControl->GetPageId(i);
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( nID ) );
if ( !pPage )
continue;
(this->*_pOperation)( *pPage, _pArgument );
@@ -437,13 +444,13 @@ namespace pcr
{
if ( !_bShow )
{
- sal_uInt16 nPagePos = m_aTabControl.GetPagePos( _nPageId );
+ sal_uInt16 nPagePos = m_aTabControl->GetPagePos( _nPageId );
if ( TAB_PAGE_NOTFOUND == nPagePos )
return;
DBG_ASSERT( m_aHiddenPages.find( _nPageId ) == m_aHiddenPages.end(), "OPropertyEditor::ShowPropertyPage: page already hidden!" );
- m_aHiddenPages[ _nPageId ] = HiddenPage( nPagePos, m_aTabControl.GetTabPage( _nPageId ) );
- m_aTabControl.RemovePage( _nPageId );
+ m_aHiddenPages[ _nPageId ] = HiddenPage( nPagePos, m_aTabControl->GetTabPage( _nPageId ) );
+ m_aTabControl->RemovePage( _nPageId );
}
else
{
@@ -451,9 +458,9 @@ namespace pcr
if ( aPagePos == m_aHiddenPages.end() )
return;
- aPagePos->second.pPage->SetSizePixel( m_aTabControl.GetTabPageSizePixel() );
- m_aTabControl.InsertPage( aPagePos->first, aPagePos->second.pPage->GetText(), aPagePos->second.nPos );
- m_aTabControl.SetTabPage( aPagePos->first, aPagePos->second.pPage );
+ aPagePos->second.pPage->SetSizePixel( m_aTabControl->GetTabPageSizePixel() );
+ m_aTabControl->InsertPage( aPagePos->first, aPagePos->second.pPage->GetText(), aPagePos->second.nPos );
+ m_aTabControl->SetTabPage( aPagePos->first, aPagePos->second.pPage );
m_aHiddenPages.erase( aPagePos );
}
@@ -462,9 +469,9 @@ namespace pcr
void OPropertyEditor::EnablePropertyControls( const OUString& _rEntryName, sal_Int16 _nControls, bool _bEnable )
{
- for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i )
+ for ( sal_uInt16 i = 0; i < m_aTabControl->GetPageCount(); ++i )
{
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( m_aTabControl->GetPageId( i ) ) );
if ( pPage )
pPage->getListBox().EnablePropertyControls( _rEntryName, _nControls, _bEnable );
}
@@ -473,9 +480,9 @@ namespace pcr
void OPropertyEditor::EnablePropertyLine( const OUString& _rEntryName, bool _bEnable )
{
- for ( sal_uInt16 i = 0; i < m_aTabControl.GetPageCount(); ++i )
+ for ( sal_uInt16 i = 0; i < m_aTabControl->GetPageCount(); ++i )
{
- OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl.GetTabPage( m_aTabControl.GetPageId( i ) ) );
+ OBrowserPage* pPage = static_cast< OBrowserPage* >( m_aTabControl->GetTabPage( m_aTabControl->GetPageId( i ) ) );
if ( pPage )
pPage->getListBox().EnablePropertyLine( _rEntryName, _bEnable );
}
@@ -486,7 +493,7 @@ namespace pcr
{
Reference< XPropertyControl > xControl;
// let the current page handle this
- OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage(m_aTabControl.GetCurPageId()));
+ OBrowserPage* pPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage(m_aTabControl->GetCurPageId()));
if (pPage)
xControl = pPage->getListBox().GetPropertyControl(rEntryName);
return xControl;
@@ -505,8 +512,8 @@ namespace pcr
{
// commit the data on the current (to-be-decativated) tab page
// (79404)
- sal_Int32 nCurrentId = m_aTabControl.GetCurPageId();
- OBrowserPage* pCurrentPage = static_cast<OBrowserPage*>(m_aTabControl.GetTabPage((sal_uInt16)nCurrentId));
+ sal_Int32 nCurrentId = m_aTabControl->GetCurPageId();
+ OBrowserPage* pCurrentPage = static_cast<OBrowserPage*>(m_aTabControl->GetTabPage((sal_uInt16)nCurrentId));
if ( !pCurrentPage )
return 1L;
diff --git a/extensions/source/propctrlr/propertyeditor.hxx b/extensions/source/propctrlr/propertyeditor.hxx
index 53e48fd..72f3644 100644
--- a/extensions/source/propctrlr/propertyeditor.hxx
+++ b/extensions/source/propctrlr/propertyeditor.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/inspection/XPropertyControl.hpp>
#include <vcl/tabctrl.hxx>
+#include <vcl/vclptr.hxx>
#include <boost/mem_fn.hpp>
#include <map>
@@ -54,7 +55,7 @@ namespace pcr
};
private:
- TabControl m_aTabControl;
+ VclPtr<TabControl> m_aTabControl;
IPropertyLineListener* m_pListener;
IPropertyControlObserver* m_pObserver;
sal_uInt16 m_nNextId;
@@ -74,6 +75,7 @@ namespace pcr
OPropertyEditor (vcl::Window* pParent, WinBits nWinStyle = WB_DIALOGCONTROL);
virtual ~OPropertyEditor();
+ virtual void dispose() SAL_OVERRIDE;
void EnableUpdate();
void DisableUpdate();
diff --git a/extensions/source/propctrlr/selectlabeldialog.cxx b/extensions/source/propctrlr/selectlabeldialog.cxx
index 79f37b5..a98910a 100644
--- a/extensions/source/propctrlr/selectlabeldialog.cxx
+++ b/extensions/source/propctrlr/selectlabeldialog.cxx
@@ -145,6 +145,11 @@ namespace pcr
OSelectLabelDialog::~OSelectLabelDialog()
{
+ dispose();
+ }
+
+ void OSelectLabelDialog::dispose()
+ {
// delete the entry datas of the listbox entries
SvTreeListEntry* pLoop = m_pControlTree->First();
while (pLoop)
@@ -154,7 +159,7 @@ namespace pcr
delete static_cast<Reference< XPropertySet > *>(pData);
pLoop = m_pControlTree->Next(pLoop);
}
-
+ ModalDialog::dispose();
}
sal_Int32 OSelectLabelDialog::InsertEntries(const Reference< XInterface > & _xContainer, SvTreeListEntry* pContainerEntry)
diff --git a/extensions/source/propctrlr/selectlabeldialog.hxx b/extensions/source/propctrlr/selectlabeldialog.hxx
index abb1382..40073fd 100644
--- a/extensions/source/propctrlr/selectlabeldialog.hxx
+++ b/extensions/source/propctrlr/selectlabeldialog.hxx
@@ -58,6 +58,7 @@ namespace pcr
public:
OSelectLabelDialog(vcl::Window* pParent, ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > _xControlModel);
virtual ~OSelectLabelDialog();
+ virtual void dispose() SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > GetSelected() const { return m_pNoAssignment->IsChecked() ? ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > () : m_xSelectedControl; }
diff --git a/extensions/source/propctrlr/standardcontrol.cxx b/extensions/source/propctrlr/standardcontrol.cxx
index bd92340..c4b452c 100644
--- a/extensions/source/propctrlr/standardcontrol.cxx
+++ b/extensions/source/propctrlr/standardcontrol.cxx
@@ -959,14 +959,16 @@ namespace pcr
class OMultilineFloatingEdit : public FloatingWindow
{
private:
- MultiLineEdit m_aImplEdit;
+ VclPtr<MultiLineEdit> m_aImplEdit;
protected:
virtual void Resize() SAL_OVERRIDE;
public:
OMultilineFloatingEdit(vcl::Window* _pParen);
- MultiLineEdit& getEdit() { return m_aImplEdit; }
+ virtual ~OMultilineFloatingEdit();
+ virtual void dispose() SAL_OVERRIDE;
+ MultiLineEdit& getEdit() { return *m_aImplEdit.get(); }
protected:
virtual bool PreNotify(NotifyEvent& _rNEvt) SAL_OVERRIDE;
@@ -975,15 +977,25 @@ namespace pcr
OMultilineFloatingEdit::OMultilineFloatingEdit(vcl::Window* _pParent)
:FloatingWindow(_pParent, WB_BORDER)
- ,m_aImplEdit(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER)
+ ,m_aImplEdit(new MultiLineEdit(this, WB_VSCROLL|WB_IGNORETAB|WB_NOBORDER))
{
- m_aImplEdit.Show();
+ m_aImplEdit->Show();
}
+ OMultilineFloatingEdit::~OMultilineFloatingEdit()
+ {
+ dispose();
+ }
+
+ void OMultilineFloatingEdit::dispose()
+ {
+ m_aImplEdit.disposeAndClear();
+ FloatingWindow::dispose();
+ }
void OMultilineFloatingEdit::Resize()
{
- m_aImplEdit.SetSizePixel(GetOutputSizePixel());
+ m_aImplEdit->SetSizePixel(GetOutputSizePixel());
}
@@ -1060,6 +1072,11 @@ namespace pcr
DropDownEditControl::~DropDownEditControl()
{
+ dispose();
+ }
+
+ void DropDownEditControl::dispose()
+ {
{
boost::scoped_ptr<vcl::Window> aTemp(m_pFloatingEdit);
m_pFloatingEdit = NULL;
@@ -1069,6 +1086,8 @@ namespace pcr
boost::scoped_ptr<vcl::Window> aTemp(m_pDropdownButton);
m_pDropdownButton = NULL;
}
+ m_pImplEdit.disposeAndClear();
+ DropDownEditControl_Base::dispose();
}
diff --git a/extensions/source/propctrlr/standardcontrol.hxx b/extensions/source/propctrlr/standardcontrol.hxx
index 17865f8..cf8c473 100644
--- a/extensions/source/propctrlr/standardcontrol.hxx
+++ b/extensions/source/propctrlr/standardcontrol.hxx
@@ -383,6 +383,7 @@ namespace pcr
public:
DropDownEditControl( vcl::Window* _pParent, WinBits _nStyle );
virtual ~DropDownEditControl();
+ virtual void dispose() SAL_OVERRIDE;
void setOperationMode( MultiLineOperationMode _eMode ) { m_nOperationMode = _eMode; }
MultiLineOperationMode getOperationMode() const { return m_nOperationMode; }
diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx
index 24fb701..64b7e10 100644
--- a/extensions/source/propctrlr/taborder.cxx
+++ b/extensions/source/propctrlr/taborder.cxx
@@ -118,10 +118,15 @@ namespace pcr
TabOrderDialog::~TabOrderDialog()
{
+ dispose();
+ }
+
+ void TabOrderDialog::dispose()
+ {
m_pLB_Controls->Hide();
// delete pLB_Controls;
delete pImageList;
-
+ ModalDialog::dispose();
}
diff --git a/extensions/source/propctrlr/taborder.hxx b/extensions/source/propctrlr/taborder.hxx
index d70e60cc..3685b9c 100644
--- a/extensions/source/propctrlr/taborder.hxx
+++ b/extensions/source/propctrlr/taborder.hxx
@@ -102,6 +102,7 @@ namespace pcr
);
virtual ~TabOrderDialog();
+ virtual void dispose() SAL_OVERRIDE;
void SetModified();
};
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 96fb625..faa33e9 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -120,6 +120,7 @@ public:
GridWindow(vcl::Window* pParent);
void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
virtual ~GridWindow();
+ virtual void dispose() SAL_OVERRIDE;
void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
@@ -214,7 +215,13 @@ GridDialog::GridDialog(double* pXValues, double* pYValues, int nValues, vcl::Win
GridWindow::~GridWindow()
{
+ dispose();
+}
+
+void GridWindow::dispose()
+{
delete [] m_pNewYValues;
+ vcl::Window::dispose();
}
double GridWindow::findMinX()
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index 9a4e50c..2dc49da 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -239,7 +239,13 @@ SaneDlg::SaneDlg( vcl::Window* pParent, Sane& rSane, bool bScanEnabled ) :
SaneDlg::~SaneDlg()
{
+ dispose();
+}
+
+void SaneDlg::dispose()
+{
mrSane.SetReloadOptionsHdl( maOldLink );
+ ModalDialog::dispose();
}
namespace {
diff --git a/extensions/source/scanner/sanedlg.hxx b/extensions/source/scanner/sanedlg.hxx
index 57eaa54..ac7d664 100644
--- a/extensions/source/scanner/sanedlg.hxx
+++ b/extensions/source/scanner/sanedlg.hxx
@@ -105,6 +105,7 @@ private:
public:
SaneDlg( vcl::Window*, Sane&, bool );
virtual ~SaneDlg();
+ virtual void dispose() SAL_OVERRIDE;
virtual short Execute() SAL_OVERRIDE;
void UpdateScanArea( bool );
commit b53f7ee341765a7b052b98a58678df25c299c58a
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jan 26 13:10:46 2015 +0200
loplugin: vclwidgets: ensure that all VclPtr fields are cleared in dispose()
Change-Id: Ie4937e1ae0d79b59ed5d74d4f3d1d135b09270bf
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index b352b2d..38a4741 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -43,6 +43,8 @@ private:
bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
};
+static const char sVclPtr[] = "VclPtr";
+
bool BaseCheckNotWindowSubclass(const CXXRecordDecl *BaseDefinition, void *) {
if (BaseDefinition->getQualifiedNameAsString().compare("vcl::Window") == 0) {
return false;
@@ -88,6 +90,10 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
return true;
}
const CXXRecordDecl * pRecordDecl = pCXXDestructorDecl->getParent();
+ // ignore vcl::Window class
+ if (pRecordDecl->getQualifiedNameAsString().compare("vcl::Window") == 0) {
+ return true;
+ }
// check if this class is derived from Window
if (!isDerivedFromWindow(pRecordDecl)) {
return true;
@@ -96,9 +102,8 @@ bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorD
for(auto fieldDecl : pRecordDecl->fields()) {
const RecordType *pFieldRecordType = fieldDecl->getType()->getAs<RecordType>();
if (pFieldRecordType) {
- const CXXRecordDecl *pFieldRecordDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl());
- static const char sVclPtr[] = "VcllPtr";
- if (pFieldRecordDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) {
+ const CXXRecordDecl *pFieldRecordTypeDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl());
+ if (pFieldRecordTypeDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) {
foundVclPtrField = true;
break;
}
@@ -180,21 +185,23 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
}
// If this field is a VclPtr field, then the class MUST have a dispose method
- static const char sVclPtr[] = "VcllPtr";
- if (recordDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) {
+ const CXXRecordDecl *pParentRecordDecl = dyn_cast<CXXRecordDecl>(fieldDecl->getParent());
+ if (pParentRecordDecl && isDerivedFromWindow(pParentRecordDecl)
+ && recordDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0)
+ {
bool foundDispose = false;
- for(auto methodDecl : recordDecl->methods()) {
+ for(auto methodDecl : pParentRecordDecl->methods()) {
if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") {
foundDispose = true;
break;
}
}
if (!foundDispose) {
- report(
- DiagnosticsEngine::Warning,
- "vcl::Window subclass with a VclPtr field MUST have a dispose() method.",
- recordDecl->getLocation())
- << recordDecl->getSourceRange();
+ report(
+ DiagnosticsEngine::Warning,
+ "vcl::Window subclass with a VclPtr field MUST have a dispose() method.",
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
}
}
@@ -258,6 +265,47 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
}
}
}
+ // check dispose method to make sure we are actually disposing all of the VclPtr fields
+ if (pMethodDecl && pMethodDecl->isInstance() && pMethodDecl->getBody() && pMethodDecl->param_size()==0
+ && pMethodDecl->getNameAsString() == "dispose")
+ {
+ std::vector<std::string> aVclPtrFields;
+ for(auto fieldDecl : pMethodDecl->getParent()->fields()) {
+ const RecordType *pFieldRecordType = fieldDecl->getType()->getAs<RecordType>();
+ if (pFieldRecordType) {
+ const CXXRecordDecl *pFieldRecordTypeDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl());
+ if (pFieldRecordTypeDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) {
+ aVclPtrFields.push_back(fieldDecl->getNameAsString());
+ }
+ }
+ }
+ if (!aVclPtrFields.empty()) {
+ const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pMethodDecl->getBody());
+ for(const Stmt* pStmt : pCompoundStatement->body()) {
+ const CallExpr *pCallExpr = dyn_cast<CallExpr>(pStmt);
+ if (!pCallExpr) continue;
+ if (!pCallExpr->getDirectCallee()) continue;
+ const CXXMethodDecl *pCalleeMethodDecl = dyn_cast<CXXMethodDecl>(pCallExpr->getDirectCallee());
+ if (!pCalleeMethodDecl) continue;
+ if (pCalleeMethodDecl->getNameAsString() != "disposeAndClear") continue;
+ const MemberExpr *pCalleeMemberExpr = dyn_cast<MemberExpr>(pCallExpr->getCallee());
+ if (!pCalleeMemberExpr) continue;
+ const MemberExpr *pCalleeMemberExprBase = dyn_cast<MemberExpr>(pCalleeMemberExpr->getBase());
+ std::string xxx = pCalleeMemberExprBase->getMemberDecl()->getNameAsString();
+ aVclPtrFields.erase(std::remove(aVclPtrFields.begin(), aVclPtrFields.end(), xxx), aVclPtrFields.end());
+ }
+ if (!aVclPtrFields.empty()) {
+ std::string aMessage = "vcl::Window subclass dispose() method does not call disposeAndClear() on the following field(s) ";
+ for(auto s : aVclPtrFields)
+ aMessage += ", " + s;
+ report(
+ DiagnosticsEngine::Warning,
+ aMessage,
+ functionDecl->getBody()->getLocStart())
+ << functionDecl->getBody()->getSourceRange();
+ }
+ }
+ }
return true;
}
commit 2998905b95301a3810c5a759428f3c6d6ec5ce29
Author: Noel Grandin <noel at peralex.com>
Date: Mon Jan 26 08:43:33 2015 +0200
loplugin: vclwidgets: make the dispose/destructor checking more robust
Change-Id: I94500963fb28550d664d3547e8f12b7f6fb681ca
diff --git a/compilerplugins/clang/vclwidgets.cxx b/compilerplugins/clang/vclwidgets.cxx
index 402351e..b352b2d 100644
--- a/compilerplugins/clang/vclwidgets.cxx
+++ b/compilerplugins/clang/vclwidgets.cxx
@@ -31,14 +31,14 @@ public:
virtual void run() override { TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); }
- bool VisitCXXRecordDecl(const CXXRecordDecl * decl);
-
bool VisitFieldDecl(const FieldDecl * decl);
bool VisitParmVarDecl(ParmVarDecl const * decl);
bool VisitFunctionDecl( const FunctionDecl* var );
+ bool VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorDecl);
+
private:
bool isDisposeCallingSuperclassDispose(const CXXMethodDecl* pMethodDecl);
};
@@ -79,32 +79,67 @@ bool isPointerToWindowSubclass(const QualType& pType) {
return isDerivedFromWindow(recordDecl);
}
-bool VCLWidgets::VisitCXXRecordDecl(const CXXRecordDecl * recordDecl) {
- if (ignoreLocation(recordDecl)) {
+bool VCLWidgets::VisitCXXDestructorDecl(const CXXDestructorDecl* pCXXDestructorDecl)
+{
+ if (ignoreLocation(pCXXDestructorDecl)) {
return true;
}
- if (!recordDecl->isCompleteDefinition())
+ if (!pCXXDestructorDecl->hasBody()) {
return true;
+ }
+ const CXXRecordDecl * pRecordDecl = pCXXDestructorDecl->getParent();
// check if this class is derived from Window
- if (!isDerivedFromWindow(recordDecl)) {
+ if (!isDerivedFromWindow(pRecordDecl)) {
return true;
}
- if (!recordDecl->hasUserDeclaredDestructor()) {
- return true;
+ bool foundVclPtrField = false;
+ for(auto fieldDecl : pRecordDecl->fields()) {
+ const RecordType *pFieldRecordType = fieldDecl->getType()->getAs<RecordType>();
+ if (pFieldRecordType) {
+ const CXXRecordDecl *pFieldRecordDecl = dyn_cast<CXXRecordDecl>(pFieldRecordType->getDecl());
+ static const char sVclPtr[] = "VcllPtr";
+ if (pFieldRecordDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) {
+ foundVclPtrField = true;
+ break;
+ }
+ }
}
bool foundDispose = false;
- for(auto methodDecl : recordDecl->methods()) {
+ for(auto methodDecl : pRecordDecl->methods()) {
if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") {
foundDispose = true;
break;
}
}
- if (!foundDispose) {
+ const CompoundStmt *pCompoundStatement = dyn_cast<CompoundStmt>(pCXXDestructorDecl->getBody());
+ // having an empty body and no dispose() method is fine
+ if (!foundVclPtrField && !foundDispose && pCompoundStatement->size() == 0) {
+ return true;
+ }
+ if (foundVclPtrField && pCompoundStatement->size() == 0) {
report(
DiagnosticsEngine::Warning,
- "vcl::Window subclass with destructor should declare a dispose() method.",
- recordDecl->getLocation())
- << recordDecl->getSourceRange();
+ "vcl::Window subclass with VclPtr field must call dispose() from it's destructor.",
+ pCXXDestructorDecl->getBody()->getLocStart())
+ << pCXXDestructorDecl->getBody()->getSourceRange();
+ return true;
+ }
+ // check that the destructor for a vcl::Window subclass does nothing except call into the dispose() method
+ bool ok = false;
+ if (pCompoundStatement->size() == 1) {
+ const CXXMemberCallExpr *pCallExpr = dyn_cast<CXXMemberCallExpr>(*pCompoundStatement->body_begin());
+ if (pCallExpr) {
+ ok = true;
+ }
+ }
+ if (!ok) {
+ report(
+ DiagnosticsEngine::Warning,
+ "vcl::Window subclass should have nothing in it's destructor but a call to dispose().",
+ pCXXDestructorDecl->getBody()->getLocStart())
+ << pCXXDestructorDecl->getBody()->getSourceRange()
+ << pCXXDestructorDecl->getCanonicalDecl()->getSourceRange();
+ return true;
}
return true;
}
@@ -134,16 +169,35 @@ bool VCLWidgets::VisitFieldDecl(const FieldDecl * fieldDecl) {
if (recordDecl == nullptr) {
return true;
}
+
// check if this field is derived from Window
- if (!isDerivedFromWindow(recordDecl)) {
- return true;
+ if (isDerivedFromWindow(recordDecl)) {
+ report(
+ DiagnosticsEngine::Warning,
+ "vcl::Window subclass allocated as a class member, should be allocated via VclPtr.",
+ fieldDecl->getLocation())
+ << fieldDecl->getSourceRange();
+ }
+
+ // If this field is a VclPtr field, then the class MUST have a dispose method
+ static const char sVclPtr[] = "VcllPtr";
+ if (recordDecl->getQualifiedNameAsString().compare(0, strlen(sVclPtr), sVclPtr) == 0) {
+ bool foundDispose = false;
+ for(auto methodDecl : recordDecl->methods()) {
+ if (methodDecl->isInstance() && methodDecl->param_size()==0 && methodDecl->getNameAsString() == "dispose") {
+ foundDispose = true;
+ break;
+ }
+ }
+ if (!foundDispose) {
+ report(
+ DiagnosticsEngine::Warning,
+ "vcl::Window subclass with a VclPtr field MUST have a dispose() method.",
+ recordDecl->getLocation())
+ << recordDecl->getSourceRange();
+ }
}
- report(
- DiagnosticsEngine::Warning,
- "vcl::Window subclass allocated as a class member, should be allocated via VclPtr.",
- fieldDecl->getLocation())
- << fieldDecl->getSourceRange();
return true;
}
@@ -179,6 +233,7 @@ bool VCLWidgets::VisitFunctionDecl( const FunctionDecl* functionDecl )
&& pMethodDecl->getParent()->getQualifiedNameAsString().find("VclPtr") != std::string::npos) {
return true;
}
+ // ignore the vcl::Window::dispose() method
if (pMethodDecl
&& pMethodDecl->getParent()->getQualifiedNameAsString().compare("vcl::Window") == 0) {
return true;
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list