diff options
Diffstat (limited to 'xmlsecurity/source/dialogs')
-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 |
4 files changed, 167 insertions, 31 deletions
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() |