diff options
author | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-25 11:45:06 +0200 |
---|---|---|
committer | Thomas Lange [tl] <tl@openoffice.org> | 2010-05-25 11:45:06 +0200 |
commit | 584157c19d5cac970b305645e6a478c6a2af3bef (patch) | |
tree | 909eafbd595f53fcd75c24ff2355d41864fd4a0c | |
parent | f4385ed8bf1da56c716bd4e48c5f5d739127c0d9 (diff) |
cws tl79: #i110254# security tab page in 'File/Properties'
-rwxr-xr-x | sc/source/ui/docshell/docsh.cxx | 53 | ||||
-rwxr-xr-x | sc/source/ui/docshell/docsh4.cxx | 37 | ||||
-rwxr-xr-x | sc/source/ui/inc/docsh.hxx | 6 |
3 files changed, 69 insertions, 27 deletions
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 4c808764b349..ca9771904fda 100755 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2635,16 +2635,47 @@ sal_Bool ScDocShell::AcceptStateUpdate() const //-->Added by PengYunQuan for Validity Cell Range Picker +bool ScDocShell::IsChangeRecording() const +{ + ScChangeTrack* pChangeTrack = aDocument.GetChangeTrack(); + return pChangeTrack != NULL; +} + + +bool ScDocShell::HasChangeRecordProtection() const +{ + bool bRes = false; + ScChangeTrack* pChangeTrack = aDocument.GetChangeTrack(); + if (pChangeTrack) + bRes = pChangeTrack->IsProtected(); + return bRes; +} + + void ScDocShell::SetChangeRecording( bool bActivate ) { - ScDocument * pDoc = GetDocument(); - DBG_ASSERT( pDoc, "ScDocument missing" ); - if (pDoc) + bool bOldChangeRecording = IsChangeRecording(); + + if (bActivate) { - if (bActivate) - pDoc->StartChangeTracking(); - else - pDoc->EndChangeTracking(); + aDocument.StartChangeTracking(); + ScChangeViewSettings aChangeViewSet; + aChangeViewSet.SetShowChanges(TRUE); + aDocument.SetChangeViewSettings(aChangeViewSet); + } + else + { + aDocument.EndChangeTracking(); + PostPaintGridAll(); + } + + if (bOldChangeRecording != IsChangeRecording()) + { + UpdateAcceptChangesDialog(); + // Slots invalidieren + SfxBindings* pBindings = GetViewBindings(); + if (pBindings) + pBindings->InvalidateAll(FALSE); } } @@ -2655,6 +2686,8 @@ bool ScDocShell::SetProtectionPassword( const String &rNewPassword ) ScChangeTrack* pChangeTrack = aDocument.GetChangeTrack(); if (pChangeTrack) { + sal_Bool bProtected = pChangeTrack->IsProtected(); + if (rNewPassword.Len()) { // when password protection is applied change tracking must always be active @@ -2669,6 +2702,12 @@ bool ScDocShell::SetProtectionPassword( const String &rNewPassword ) pChangeTrack->SetProtection( ::com::sun::star::uno::Sequence< sal_Int8 >() ); } bRes = true; + + if ( bProtected != pChangeTrack->IsProtected() ) + { + UpdateAcceptChangesDialog(); + SetDocumentModified(); + } } return bRes; diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index eb308b67271e..1fe5cc7a74ba 100755 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -665,17 +665,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) if ( bDo ) { - // update "accept changes" dialog - //! notify all views - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if ( pViewFrm && pViewFrm->HasChildWindow(FID_CHG_ACCEPT) ) - { - SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_CHG_ACCEPT); - if (pChild) - { - ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg(); - } - } + UpdateAcceptChangesDialog(); // Slots invalidieren if (pBindings) @@ -1165,6 +1155,21 @@ void ScDocShell::Execute( SfxRequest& rReq ) //------------------------------------------------------------------ +void UpdateAcceptChangesDialog() +{ + // update "accept changes" dialog + //! notify all views + SfxViewFrame* pViewFrm = SfxViewFrame::Current(); + if ( pViewFrm && pViewFrm->HasChildWindow( FID_CHG_ACCEPT ) ) + { + SfxChildWindow* pChild = pViewFrm->GetChildWindow( FID_CHG_ACCEPT ); + if ( pChild ) + ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg(); + } +} + +//------------------------------------------------------------------ + BOOL ScDocShell::ExecuteChangeProtectionDialog( Window* _pParent, BOOL bJustQueryIfProtected ) { BOOL bDone = FALSE; @@ -1218,15 +1223,7 @@ BOOL ScDocShell::ExecuteChangeProtectionDialog( Window* _pParent, BOOL bJustQuer } if ( bProtected != pChangeTrack->IsProtected() ) { - // update "accept changes" dialog - //! notify all views - SfxViewFrame* pViewFrm = SfxViewFrame::Current(); - if ( pViewFrm && pViewFrm->HasChildWindow( FID_CHG_ACCEPT ) ) - { - SfxChildWindow* pChild = pViewFrm->GetChildWindow( FID_CHG_ACCEPT ); - if ( pChild ) - ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg(); - } + UpdateAcceptChangesDialog(); bDone = TRUE; } } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index 2c28663d107d..e4c02458ec6e 100755 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -421,11 +421,17 @@ public: // passwword protection for Calc (derived from SfxObjectShell) // see also: FID_CHG_RECORD, SID_CHG_PROTECT + virtual bool IsChangeRecording() const; + virtual bool HasChangeRecordProtection() const; virtual void SetChangeRecording( bool bActivate ); virtual bool SetProtectionPassword( const String &rPassword ); virtual bool GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > &rPasswordHash ); }; + +void UpdateAcceptChangesDialog(); + + SO2_DECL_REF(ScDocShell) SO2_IMPL_REF(ScDocShell) |