diff options
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/inc/xmlsecurity/certificatechooser.hxx | 7 | ||||
-rw-r--r-- | xmlsecurity/inc/xmlsecurity/certificateviewer.hxx | 41 | ||||
-rw-r--r-- | xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx | 37 | ||||
-rw-r--r-- | xmlsecurity/inc/xmlsecurity/macrosecurity.hxx | 42 | ||||
-rw-r--r-- | xmlsecurity/source/component/documentdigitalsignatures.cxx | 33 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificatechooser.cxx | 16 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/certificateviewer.cxx | 78 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 39 | ||||
-rw-r--r-- | xmlsecurity/source/dialogs/macrosecurity.cxx | 65 |
9 files changed, 255 insertions, 103 deletions
diff --git a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx index f12837a49ca2..353473ca6c8d 100644 --- a/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx +++ b/xmlsecurity/inc/xmlsecurity/certificatechooser.hxx @@ -48,9 +48,9 @@ private: css::uno::Sequence< css::uno::Reference< css::security::XCertificate > > maCerts; SignatureInformations maCertsToIgnore; - SvSimpleTable* m_pCertLB; - PushButton* m_pViewBtn; - OKButton* m_pOKBtn; + VclPtr<SvSimpleTable> m_pCertLB; + VclPtr<PushButton> m_pViewBtn; + VclPtr<OKButton> m_pOKBtn; bool mbInitialized; @@ -65,6 +65,7 @@ private: public: CertificateChooser( vcl::Window* pParent, css::uno::Reference< css::uno::XComponentContext>& rxCtx, css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const SignatureInformations& rCertsToIgnore ); virtual ~CertificateChooser(); + virtual void dispose() SAL_OVERRIDE; short Execute() SAL_OVERRIDE; diff --git a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx index f3eea2ba062d..3f61891bc0fd 100644 --- a/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx +++ b/xmlsecurity/inc/xmlsecurity/certificateviewer.hxx @@ -46,7 +46,7 @@ private: friend class CertificateViewerDetailsTP; friend class CertificateViewerCertPathTP; - TabControl* mpTabCtrl; + VclPtr<TabControl> mpTabCtrl; sal_uInt16 mnGeneralId; sal_uInt16 mnDetailsId; sal_uInt16 mnPathId; @@ -58,16 +58,19 @@ private: public: CertificateViewer( vcl::Window* pParent, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment, const css::uno::Reference< css::security::XCertificate >& rXCert, bool bCheckForPrivateKey ); virtual ~CertificateViewer(); + virtual void dispose() SAL_OVERRIDE; }; class CertificateViewerTP : public TabPage { protected: - CertificateViewer* mpDlg; + VclPtr<CertificateViewer> mpDlg; public: CertificateViewerTP( vcl::Window* _pParent, const OString& rID, const OUString& rUIXMLDescription, CertificateViewer* _pDlg ); + virtual ~CertificateViewerTP(); + virtual void dispose() SAL_OVERRIDE; void SetTabDlg( CertificateViewer* _pTabDlg ) { mpDlg = _pTabDlg; @@ -77,16 +80,18 @@ public: class CertificateViewerGeneralTP : public CertificateViewerTP { private: - FixedImage* m_pCertImg; - FixedText* m_pHintNotTrustedFI; - FixedText* m_pIssuedToFI; - FixedText* m_pIssuedByFI; - FixedText* m_pValidFromDateFI; - FixedText* m_pValidToDateFI; - FixedImage* m_pKeyImg; - FixedText* m_pHintCorrespPrivKeyFI; + VclPtr<FixedImage> m_pCertImg; + VclPtr<FixedText> m_pHintNotTrustedFI; + VclPtr<FixedText> m_pIssuedToFI; + VclPtr<FixedText> m_pIssuedByFI; + VclPtr<FixedText> m_pValidFromDateFI; + VclPtr<FixedText> m_pValidToDateFI; + VclPtr<FixedImage> m_pKeyImg; + VclPtr<FixedText> m_pHintCorrespPrivKeyFI; public: CertificateViewerGeneralTP( vcl::Window* pParent, CertificateViewer* _pDlg ); + virtual ~CertificateViewerGeneralTP(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage() SAL_OVERRIDE; }; @@ -95,9 +100,9 @@ public: class CertificateViewerDetailsTP : public CertificateViewerTP { private: - SvSimpleTableContainer* m_pElementsLBContainer; - SvSimpleTable* m_pElementsLB; - MultiLineEdit* m_pValueDetails; + VclPtr<SvSimpleTableContainer> m_pElementsLBContainer; + VclPtr<SvSimpleTable> m_pElementsLB; + VclPtr<MultiLineEdit> m_pValueDetails; vcl::Font m_aStdFont; vcl::Font m_aFixedWidthFont; @@ -108,6 +113,7 @@ private: public: CertificateViewerDetailsTP( vcl::Window* pParent, CertificateViewer* _pDlg ); virtual ~CertificateViewerDetailsTP(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage() SAL_OVERRIDE; }; @@ -116,11 +122,11 @@ public: class CertificateViewerCertPathTP : public CertificateViewerTP { private: - SvTreeListBox* mpCertPathLB; - PushButton* mpViewCertPB; - VclMultiLineEdit* mpCertStatusML; + VclPtr<SvTreeListBox> mpCertPathLB; + VclPtr<PushButton> mpViewCertPB; + VclPtr<VclMultiLineEdit> mpCertStatusML; - CertificateViewer* mpParent; + VclPtr<CertificateViewer> mpParent; bool mbFirstActivateDone; Image maCertImage; Image maCertNotValidatedImage; @@ -137,6 +143,7 @@ private: public: CertificateViewerCertPathTP( vcl::Window* pParent, CertificateViewer* _pDlg ); virtual ~CertificateViewerCertPathTP(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage() SAL_OVERRIDE; }; diff --git a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx index c73fc3bbbd3b..a3cdb392bb45 100644 --- a/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx +++ b/xmlsecurity/inc/xmlsecurity/digitalsignaturesdialog.hxx @@ -63,24 +63,24 @@ private: DocumentSignatureMode meSignatureMode; css::uno::Sequence < css::uno::Sequence < css::beans::PropertyValue > > m_manifest; - FixedText* m_pHintDocFT; - FixedText* m_pHintBasicFT; - FixedText* m_pHintPackageFT; - SvSimpleTable* m_pSignaturesLB; - FixedImage* m_pSigsValidImg; - FixedText* m_pSigsValidFI; - FixedImage* m_pSigsInvalidImg; - FixedText* m_pSigsInvalidFI; - FixedImage* m_pSigsNotvalidatedImg; - FixedText* m_pSigsNotvalidatedFI; - FixedImage* m_pSigsOldSignatureImg; - FixedText* m_pSigsOldSignatureFI; - - PushButton* m_pViewBtn; - PushButton* m_pAddBtn; - PushButton* m_pRemoveBtn; - - CloseButton* m_pCloseBtn; + VclPtr<FixedText> m_pHintDocFT; + VclPtr<FixedText> m_pHintBasicFT; + VclPtr<FixedText> m_pHintPackageFT; + VclPtr<SvSimpleTable> m_pSignaturesLB; + VclPtr<FixedImage> m_pSigsValidImg; + VclPtr<FixedText> m_pSigsValidFI; + VclPtr<FixedImage> m_pSigsInvalidImg; + VclPtr<FixedText> m_pSigsInvalidFI; + VclPtr<FixedImage> m_pSigsNotvalidatedImg; + VclPtr<FixedText> m_pSigsNotvalidatedFI; + VclPtr<FixedImage> m_pSigsOldSignatureImg; + VclPtr<FixedText> m_pSigsOldSignatureFI; + + VclPtr<PushButton> m_pViewBtn; + VclPtr<PushButton> m_pAddBtn; + VclPtr<PushButton> m_pRemoveBtn; + + VclPtr<CloseButton> m_pCloseBtn; OUString m_sODFVersion; //Signals if the document contains already a document signature. This is only @@ -117,6 +117,7 @@ public: css::uno::XComponentContext >& rxCtx, DocumentSignatureMode eMode, bool bReadOnly, const OUString& sODFVersion, bool bHasDocumentSignature); virtual ~DigitalSignaturesDialog(); + virtual void dispose() SAL_OVERRIDE; // Initialize the dialog and the security environment, returns TRUE on success bool Init(); diff --git a/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx b/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx index 2707fe5e2ccd..8f0edfd44e85 100644 --- a/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx +++ b/xmlsecurity/inc/xmlsecurity/macrosecurity.hxx @@ -47,9 +47,9 @@ private: friend class MacroSecurityLevelTP; friend class MacroSecurityTrustedSourcesTP; - TabControl* m_pTabCtrl; - OKButton* m_pOkBtn; - PushButton* m_pResetBtn; + VclPtr<TabControl> m_pTabCtrl; + VclPtr<OKButton> m_pOkBtn; + VclPtr<PushButton> m_pResetBtn; css::uno::Reference< css::uno::XComponentContext > mxCtx; css::uno::Reference< css::xml::crypto::XSecurityEnvironment > mxSecurityEnvironment; @@ -58,8 +58,8 @@ private: sal_uInt16 m_nSecLevelId; sal_uInt16 m_nSecTrustId; - MacroSecurityTP* mpLevelTP; - MacroSecurityTP* mpTrustSrcTP; + VclPtr<MacroSecurityTP> mpLevelTP; + VclPtr<MacroSecurityTP> mpTrustSrcTP; DECL_LINK( OkBtnHdl, void* ); public: @@ -67,6 +67,7 @@ public: const css::uno::Reference< css::uno::XComponentContext>& rxCtx, const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& rxSecurityEnvironment); virtual ~MacroSecurity(); + virtual void dispose() SAL_OVERRIDE; inline void EnableReset(bool _bEnable = true) { @@ -77,10 +78,12 @@ public: class MacroSecurityTP : public TabPage { protected: - MacroSecurity* mpDlg; + VclPtr<MacroSecurity> mpDlg; public: MacroSecurityTP(vcl::Window* _pParent, const OString& rID, const OUString& rUIXMLDescription, MacroSecurity* _pDlg); + virtual ~MacroSecurityTP(); + virtual void dispose() SAL_OVERRIDE; void SetTabDlg(MacroSecurity* pTabDlg) { @@ -93,10 +96,10 @@ public: class MacroSecurityLevelTP : public MacroSecurityTP { private: - RadioButton* m_pVeryHighRB; - RadioButton* m_pHighRB; - RadioButton* m_pMediumRB; - RadioButton* m_pLowRB; + VclPtr<RadioButton> m_pVeryHighRB; + VclPtr<RadioButton> m_pHighRB; + VclPtr<RadioButton> m_pMediumRB; + VclPtr<RadioButton> m_pLowRB; sal_uInt16 mnCurLevel; @@ -105,6 +108,8 @@ protected: public: MacroSecurityLevelTP( vcl::Window* pParent, MacroSecurity* _pDlg ); + virtual ~MacroSecurityLevelTP(); + virtual void dispose() SAL_OVERRIDE; virtual void ClosePage() SAL_OVERRIDE; }; @@ -113,14 +118,14 @@ public: class MacroSecurityTrustedSourcesTP : public MacroSecurityTP { private: - FixedImage* m_pTrustCertROFI; - SvSimpleTable* m_pTrustCertLB; - PushButton* m_pViewCertPB; - PushButton* m_pRemoveCertPB; - FixedImage* m_pTrustFileROFI; - ListBox* m_pTrustFileLocLB; - PushButton* m_pAddLocPB; - PushButton* m_pRemoveLocPB; + VclPtr<FixedImage> m_pTrustCertROFI; + VclPtr<SvSimpleTable> m_pTrustCertLB; + VclPtr<PushButton> m_pViewCertPB; + VclPtr<PushButton> m_pRemoveCertPB; + VclPtr<FixedImage> m_pTrustFileROFI; + VclPtr<ListBox> m_pTrustFileLocLB; + VclPtr<PushButton> m_pAddLocPB; + VclPtr<PushButton> m_pRemoveLocPB; css::uno::Sequence< SvtSecurityOptions::Certificate > maTrustedAuthors; @@ -140,6 +145,7 @@ private: public: MacroSecurityTrustedSourcesTP(vcl::Window* pParent, MacroSecurity* _pDlg); virtual ~MacroSecurityTrustedSourcesTP(); + virtual void dispose() SAL_OVERRIDE; virtual void ActivatePage() SAL_OVERRIDE; virtual void ClosePage() SAL_OVERRIDE; diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index acaac53e3e43..287b5cf50125 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -222,17 +222,18 @@ bool DocumentDigitalSignatures::ImplViewSignatures( DocumentSignatureMode eMode, bool bReadOnly ) throw (RuntimeException, std::exception) { bool bChanges = false; - DigitalSignaturesDialog aSignaturesDialog( - NULL, mxCtx, eMode, bReadOnly, m_sODFVersion, m_bHasDocumentSignature); - bool bInit = aSignaturesDialog.Init(); + ScopedVclPtrInstance<DigitalSignaturesDialog> aSignaturesDialog( + nullptr, mxCtx, eMode, bReadOnly, m_sODFVersion, + m_bHasDocumentSignature); + bool bInit = aSignaturesDialog->Init(); DBG_ASSERT( bInit, "Error initializing security context!" ); if ( bInit ) { - aSignaturesDialog.SetStorage( rxStorage ); - aSignaturesDialog.SetSignatureStream( xSignStream ); - if ( aSignaturesDialog.Execute() ) + aSignaturesDialog->SetStorage( rxStorage ); + aSignaturesDialog->SetSignatureStream( xSignStream ); + if ( aSignaturesDialog->Execute() ) { - if ( aSignaturesDialog.SignaturesChanged() ) + if ( aSignaturesDialog->SignaturesChanged() ) { bChanges = true; // If we have a storage and no stream, we are responsible for commit @@ -246,8 +247,8 @@ bool DocumentDigitalSignatures::ImplViewSignatures( } else { - MessageDialog aBox(NULL, XMLSEC_RES(RID_XMLSECWB_NO_MOZILLA_PROFILE), VCL_MESSAGE_WARNING); - aBox.Execute(); + ScopedVclPtrInstance< MessageDialog > aBox(nullptr, XMLSEC_RES(RID_XMLSECWB_NO_MOZILLA_PROFILE), VCL_MESSAGE_WARNING); + aBox->Execute(); } return bChanges; @@ -386,8 +387,8 @@ void DocumentDigitalSignatures::manageTrustedSources( ) throw (RuntimeException if ( aSignatureHelper.Init() ) xSecEnv = aSignatureHelper.GetSecurityEnvironment(); - MacroSecurity aDlg( NULL, mxCtx, xSecEnv ); - aDlg.Execute(); + ScopedVclPtrInstance< MacroSecurity > aDlg( nullptr, mxCtx, xSecEnv ); + aDlg->Execute(); } void DocumentDigitalSignatures::showCertificate( @@ -401,8 +402,8 @@ void DocumentDigitalSignatures::showCertificate( if ( bInit ) { - CertificateViewer aViewer( NULL, aSignatureHelper.GetSecurityEnvironment(), _Certificate, false ); - aViewer.Execute(); + ScopedVclPtrInstance< CertificateViewer > aViewer( nullptr, aSignatureHelper.GetSecurityEnvironment(), _Certificate, false ); + aViewer->Execute(); } } @@ -441,12 +442,12 @@ Reference< css::security::XCertificate > DocumentDigitalSignatures::chooseCertif if ( aSignatureHelper.Init() ) xSecEnv = aSignatureHelper.GetSecurityEnvironment(); - CertificateChooser aChooser( NULL, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations()); + ScopedVclPtrInstance< CertificateChooser > aChooser( nullptr, mxCtx, xSecEnv, aSignatureHelper.GetSignatureInformations()); - if (aChooser.Execute() != RET_OK) + if (aChooser->Execute() != RET_OK) return Reference< css::security::XCertificate >(0); - Reference< css::security::XCertificate > xCert = aChooser.GetSelectedCertificate(); + Reference< css::security::XCertificate > xCert = aChooser->GetSelectedCertificate(); if ( !xCert.is() ) return Reference< css::security::XCertificate >(0); diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx b/xmlsecurity/source/dialogs/certificatechooser.cxx index 4f822527997b..9c5e28e94b67 100644 --- a/xmlsecurity/source/dialogs/certificatechooser.cxx +++ b/xmlsecurity/source/dialogs/certificatechooser.cxx @@ -62,7 +62,7 @@ CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< u pSignatures->set_width_request(aControlSize.Width()); pSignatures->set_height_request(aControlSize.Height()); - m_pCertLB = new SvSimpleTable(*pSignatures); + m_pCertLB = VclPtr<SvSimpleTable>::Create(*pSignatures); static long nTabs[] = { 3, 0, 30*nControlWidth/100, 60*nControlWidth/100 }; m_pCertLB->SetTabs( &nTabs[0] ); m_pCertLB->InsertHeaderEntry(get<FixedText>("issuedto")->GetText() + "\t" + get<FixedText>("issuedby")->GetText() @@ -81,7 +81,15 @@ CertificateChooser::CertificateChooser( vcl::Window* _pParent, uno::Reference< u CertificateChooser::~CertificateChooser() { - delete m_pCertLB; + disposeOnce(); +} + +void CertificateChooser::dispose() +{ + m_pCertLB.disposeAndClear(); + m_pViewBtn.clear(); + m_pOKBtn.clear(); + ModalDialog::dispose(); } short CertificateChooser::Execute() @@ -217,8 +225,8 @@ void CertificateChooser::ImplShowCertificateDetails() uno::Reference< css::security::XCertificate > xCert = GetSelectedCertificate(); if( xCert.is() ) { - CertificateViewer aViewer( this, mxSecurityEnvironment, xCert, true ); - aViewer.Execute(); + ScopedVclPtrInstance< CertificateViewer > aViewer( this, mxSecurityEnvironment, xCert, true ); + aViewer->Execute(); } } diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 7a14960be47c..61cbf28f1dae 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -53,17 +53,24 @@ CertificateViewer::CertificateViewer( mnDetailsId = mpTabCtrl->GetPageId("details"); mnPathId = mpTabCtrl->GetPageId("path"); - mpTabCtrl->SetTabPage(mnGeneralId, new CertificateViewerGeneralTP( mpTabCtrl, this)); - mpTabCtrl->SetTabPage(mnDetailsId, new CertificateViewerDetailsTP( mpTabCtrl, this)); - mpTabCtrl->SetTabPage(mnPathId, new CertificateViewerCertPathTP( mpTabCtrl, this)); + mpTabCtrl->SetTabPage(mnGeneralId, VclPtr<CertificateViewerGeneralTP>::Create( mpTabCtrl, this)); + mpTabCtrl->SetTabPage(mnDetailsId, VclPtr<CertificateViewerDetailsTP>::Create( mpTabCtrl, this)); + mpTabCtrl->SetTabPage(mnPathId, VclPtr<CertificateViewerCertPathTP>::Create( mpTabCtrl, this)); mpTabCtrl->SetCurPageId(mnGeneralId); } CertificateViewer::~CertificateViewer() { - delete mpTabCtrl->GetTabPage(mnGeneralId); - delete mpTabCtrl->GetTabPage(mnDetailsId); - delete mpTabCtrl->GetTabPage(mnPathId); + disposeOnce(); +} + +void CertificateViewer::dispose() +{ + mpTabCtrl->GetTabPage(mnGeneralId)->disposeOnce(); + mpTabCtrl->GetTabPage(mnDetailsId)->disposeOnce(); + mpTabCtrl->GetTabPage(mnPathId)->disposeOnce(); + mpTabCtrl.clear(); + TabDialog::dispose(); } CertificateViewerTP::CertificateViewerTP( vcl::Window* _pParent, const OString& rID, @@ -73,6 +80,18 @@ CertificateViewerTP::CertificateViewerTP( vcl::Window* _pParent, const OString& { } +CertificateViewerTP::~CertificateViewerTP() +{ + disposeOnce(); +} + +void CertificateViewerTP::dispose() +{ + mpDlg.clear(); + TabPage::dispose(); +} + + CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, CertificateViewer* _pDlg ) :CertificateViewerTP ( _pParent, "CertGeneral", "xmlsec/ui/certgeneral.ui", _pDlg ) { @@ -130,6 +149,24 @@ CertificateViewerGeneralTP::CertificateViewerGeneralTP( vcl::Window* _pParent, C } } +CertificateViewerGeneralTP::~CertificateViewerGeneralTP() +{ + disposeOnce(); +} + +void CertificateViewerGeneralTP::dispose() +{ + m_pCertImg.clear(); + m_pHintNotTrustedFI.clear(); + m_pIssuedToFI.clear(); + m_pIssuedByFI.clear(); + m_pValidFromDateFI.clear(); + m_pValidToDateFI.clear(); + m_pKeyImg.clear(); + m_pHintCorrespPrivKeyFI.clear(); + CertificateViewerTP::dispose(); +} + void CertificateViewerGeneralTP::ActivatePage() { @@ -180,7 +217,7 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C { get( m_pValueDetails, "valuedetails" ); get( m_pElementsLBContainer, "tablecontainer" ); - m_pElementsLB = new SvSimpleTable( *m_pElementsLBContainer ); + m_pElementsLB = VclPtr<SvSimpleTable>::Create( *m_pElementsLBContainer ); m_aStdFont = m_pValueDetails->GetControlFont(); WinBits nStyle = m_pElementsLB->GetStyle(); @@ -256,8 +293,16 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP( vcl::Window* _pParent, C CertificateViewerDetailsTP::~CertificateViewerDetailsTP() { + disposeOnce(); +} + +void CertificateViewerDetailsTP::dispose() +{ Clear(); - delete m_pElementsLB; + m_pElementsLB.disposeAndClear(); + m_pElementsLBContainer.clear(); + m_pValueDetails.clear(); + CertificateViewerTP::dispose(); } void CertificateViewerDetailsTP::ActivatePage() @@ -327,7 +372,17 @@ CertificateViewerCertPathTP::CertificateViewerCertPathTP( vcl::Window* _pParent, CertificateViewerCertPathTP::~CertificateViewerCertPathTP() { + disposeOnce(); +} + +void CertificateViewerCertPathTP::dispose() +{ Clear(); + mpCertPathLB.clear(); + mpViewCertPB.clear(); + mpCertStatusML.clear(); + mpParent.clear(); + CertificateViewerTP::dispose(); } void CertificateViewerCertPathTP::ActivatePage() @@ -370,8 +425,11 @@ IMPL_LINK_NOARG(CertificateViewerCertPathTP, ViewCertHdl) SvTreeListEntry* pEntry = mpCertPathLB->FirstSelected(); if( pEntry ) { - CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, static_cast<CertPath_UserData*>(pEntry->GetUserData())->mxCert, false ); - aViewer.Execute(); + ScopedVclPtrInstance< CertificateViewer > aViewer( + this, mpDlg->mxSecurityEnvironment, + static_cast<CertPath_UserData*>(pEntry->GetUserData())->mxCert, + false ); + aViewer->Execute(); } return 0; diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 6f5db4db79af..9673a3c617f1 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -198,7 +198,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( pSignatures->set_width_request(aControlSize.Width()); pSignatures->set_height_request(aControlSize.Height()); - m_pSignaturesLB = new SvSimpleTable(*pSignatures); + m_pSignaturesLB = VclPtr<SvSimpleTable>::Create(*pSignatures); // #i48253# the tablistbox needs its own unique id m_pSignaturesLB->Window::SetUniqueId( HID_XMLSEC_TREE_SIGNATURESDLG ); static long aTabs[] = { 4, 0, 6*nControlWidth/100, 36*nControlWidth/100, 74*nControlWidth/100 }; @@ -235,7 +235,28 @@ DigitalSignaturesDialog::DigitalSignaturesDialog( DigitalSignaturesDialog::~DigitalSignaturesDialog() { - delete m_pSignaturesLB; + disposeOnce(); +} + +void DigitalSignaturesDialog::dispose() +{ + m_pSignaturesLB.disposeAndClear(); + m_pHintDocFT.clear(); + m_pHintBasicFT.clear(); + m_pHintPackageFT.clear(); + m_pSigsValidImg.clear(); + m_pSigsValidFI.clear(); + m_pSigsInvalidImg.clear(); + m_pSigsInvalidFI.clear(); + m_pSigsNotvalidatedImg.clear(); + m_pSigsNotvalidatedFI.clear(); + m_pSigsOldSignatureImg.clear(); + m_pSigsOldSignatureFI.clear(); + m_pViewBtn.clear(); + m_pAddBtn.clear(); + m_pRemoveBtn.clear(); + m_pCloseBtn.clear(); + ModalDialog::dispose(); } bool DigitalSignaturesDialog::Init() @@ -292,8 +313,8 @@ bool DigitalSignaturesDialog::canAddRemove() if ( (!bSave1_1 && bDoc1_1) || (bSave1_1 && bDoc1_1) ) { //#4 - MessageDialog err(NULL, XMLSEC_RES(STR_XMLSECDLG_OLD_ODF_FORMAT)); - err.Execute(); + ScopedVclPtrInstance< MessageDialog > err(nullptr, XMLSEC_RES(STR_XMLSECDLG_OLD_ODF_FORMAT)); + err->Execute(); ret = false; } @@ -411,10 +432,10 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl) uno::Reference<com::sun::star::security::XSerialNumberAdapter> xSerialNumberAdapter = ::com::sun::star::security::SerialNumberAdapter::create(mxCtx); - CertificateChooser aChooser( this, mxCtx, xSecEnv, maCurrentSignatureInformations ); - if ( aChooser.Execute() == RET_OK ) + ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnv, maCurrentSignatureInformations ); + if ( aChooser->Execute() == RET_OK ) { - uno::Reference< ::com::sun::star::security::XCertificate > xCert = aChooser.GetSelectedCertificate(); + uno::Reference< ::com::sun::star::security::XCertificate > xCert = aChooser->GetSelectedCertificate(); if ( !xCert.is() ) { SAL_WARN( "xmlsecurity.dialogs", "no certificate selected" ); @@ -746,8 +767,8 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails() DBG_ASSERT( xCert.is(), "Error getting cCertificate!" ); if ( xCert.is() ) { - CertificateViewer aViewer( this, maSignatureHelper.GetSecurityEnvironment(), xCert, false ); - aViewer.Execute(); + ScopedVclPtrInstance< CertificateViewer > aViewer( this, maSignatureHelper.GetSecurityEnvironment(), xCert, false ); + aViewer->Execute(); } } } diff --git a/xmlsecurity/source/dialogs/macrosecurity.cxx b/xmlsecurity/source/dialogs/macrosecurity.cxx index c06982339d02..1142b1dfd173 100644 --- a/xmlsecurity/source/dialogs/macrosecurity.cxx +++ b/xmlsecurity/source/dialogs/macrosecurity.cxx @@ -69,8 +69,8 @@ MacroSecurity::MacroSecurity( vcl::Window* _pParent, get(m_pResetBtn, "reset"); get(m_pOkBtn, "ok"); - mpLevelTP = new MacroSecurityLevelTP(m_pTabCtrl, this); - mpTrustSrcTP = new MacroSecurityTrustedSourcesTP(m_pTabCtrl, this); + mpLevelTP.reset(VclPtr<MacroSecurityLevelTP>::Create(m_pTabCtrl, this)); + mpTrustSrcTP.reset(VclPtr<MacroSecurityTrustedSourcesTP>::Create(m_pTabCtrl, this)); m_nSecLevelId = m_pTabCtrl->GetPageId("SecurityLevelPage"); m_nSecTrustId = m_pTabCtrl->GetPageId("SecurityTrustPage"); @@ -84,8 +84,19 @@ MacroSecurity::MacroSecurity( vcl::Window* _pParent, MacroSecurity::~MacroSecurity() { - delete m_pTabCtrl->GetTabPage(m_nSecTrustId); - delete m_pTabCtrl->GetTabPage(m_nSecLevelId); + disposeOnce(); +} + +void MacroSecurity::dispose() +{ + m_pTabCtrl->GetTabPage(m_nSecTrustId)->disposeOnce(); + m_pTabCtrl->GetTabPage(m_nSecLevelId)->disposeOnce(); + m_pTabCtrl.clear(); + m_pOkBtn.clear(); + m_pResetBtn.clear(); + mpLevelTP.disposeAndClear(); + mpTrustSrcTP.disposeAndClear(); + TabDialog::dispose(); } MacroSecurityTP::MacroSecurityTP(vcl::Window* _pParent, const OString& rID, @@ -95,6 +106,17 @@ MacroSecurityTP::MacroSecurityTP(vcl::Window* _pParent, const OString& rID, { } +MacroSecurityTP::~MacroSecurityTP() +{ + disposeOnce(); +} + +void MacroSecurityTP::dispose() +{ + mpDlg.clear(); + TabPage::dispose(); +} + MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity* _pDlg) : MacroSecurityTP(_pParent, "SecurityLevelPage", "xmlsec/ui/securitylevelpage.ui", _pDlg) { @@ -148,6 +170,20 @@ MacroSecurityLevelTP::MacroSecurityLevelTP(vcl::Window* _pParent, MacroSecurity* } } +MacroSecurityLevelTP::~MacroSecurityLevelTP() +{ + disposeOnce(); +} + +void MacroSecurityLevelTP::dispose() +{ + m_pVeryHighRB.clear(); + m_pHighRB.clear(); + m_pMediumRB.clear(); + m_pLowRB.clear(); + MacroSecurityTP::dispose(); +} + IMPL_LINK_NOARG(MacroSecurityLevelTP, RadioButtonHdl) { sal_uInt16 nNewLevel = 0; @@ -202,8 +238,8 @@ IMPL_LINK_NOARG(MacroSecurityTrustedSourcesTP, ViewCertPBHdl) if ( xCert.is() ) { - CertificateViewer aViewer( this, mpDlg->mxSecurityEnvironment, xCert, false ); - aViewer.Execute(); + ScopedVclPtrInstance< CertificateViewer > aViewer( this, mpDlg->mxSecurityEnvironment, xCert, false ); + aViewer->Execute(); } } return 0; @@ -352,7 +388,7 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(vcl::Window* _pPare get(m_pRemoveLocPB, "removefile"); SvSimpleTableContainer *pCertificates = get<SvSimpleTableContainer>("certificates"); - m_pTrustCertLB = new TrustCertLB(*pCertificates); + m_pTrustCertLB.reset(VclPtr<TrustCertLB>::Create(*pCertificates)); static long aTabs[] = { 3, 0, 0, 0 }; m_pTrustCertLB->SetTabs( aTabs ); @@ -394,7 +430,20 @@ MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP(vcl::Window* _pPare MacroSecurityTrustedSourcesTP::~MacroSecurityTrustedSourcesTP() { - delete m_pTrustCertLB; + disposeOnce(); +} + +void MacroSecurityTrustedSourcesTP::dispose() +{ + m_pTrustCertLB.disposeAndClear(); + m_pTrustCertROFI.clear(); + m_pViewCertPB.clear(); + m_pRemoveCertPB.clear(); + m_pTrustFileROFI.clear(); + m_pTrustFileLocLB.clear(); + m_pAddLocPB.clear(); + m_pRemoveLocPB.clear(); + MacroSecurityTP::dispose(); } void MacroSecurityTrustedSourcesTP::ActivatePage() |