summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/chgtrack.hxx11
-rw-r--r--sc/inc/sc.hrc10
-rw-r--r--sc/sdi/docsh.sdi6
-rw-r--r--sc/sdi/scalc.sdi23
-rw-r--r--sc/source/ui/docshell/docsh4.cxx182
-rw-r--r--sc/source/ui/miscdlgs/acredlin.cxx13
-rw-r--r--sc/source/ui/src/scstring.src52
-rw-r--r--sc/util/hidother.src5
8 files changed, 260 insertions, 42 deletions
diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx
index 3282032a1ddc..5a4cabe2d6bf 100644
--- a/sc/inc/chgtrack.hxx
+++ b/sc/inc/chgtrack.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: chgtrack.hxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: er $ $Date: 2001-02-16 17:55:31 $
+ * last change: $Author: er $ $Date: 2001-04-25 14:00:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1092,6 +1092,7 @@ class ScChangeTrack : public SfxListener
static const USHORT nContentRowsPerSlot;
static const USHORT nContentSlots;
+ com::sun::star::uno::Sequence< sal_Int8 > aProtectPass;
ScChangeActionTable aTable;
ScChangeActionTable aGeneratedTable;
ScChangeActionTable aPasteCutTable;
@@ -1443,6 +1444,12 @@ public:
void SetActionMax(ULONG nTempActionMax)
{ nActionMax = nTempActionMax; } // only to use in the XML import
+ void SetProtection( const com::sun::star::uno::Sequence< sal_Int8 >& rPass )
+ { aProtectPass = rPass; }
+ com::sun::star::uno::Sequence< sal_Int8 > GetProtection() const
+ { return aProtectPass; }
+ BOOL IsProtected() const
+ { return aProtectPass.getLength() != 0; }
};
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index 4584eb3cb6d1..d1413cd78f07 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -2,9 +2,9 @@
*
* $RCSfile: sc.hrc,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: nn $ $Date: 2001-02-09 17:58:38 $
+ * last change: $Author: er $ $Date: 2001-04-25 14:00:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -288,6 +288,8 @@
#define HID_SC_TOOLBOX_GRAPHIC ( HID_SC_TOOLBOX_START + 7 )
+#define HID_CHG_PROTECT ( HID_SC_TOOLBOX_START + 8 )
+
// Hilfe IDs fuer Submenus (max.50) ------------------------------------------
#define HID_SCMENU_EDIT ( HID_SC_MENU_START )
#define HID_SCMENU_FILL ( HID_SC_MENU_START + 1 )
@@ -446,6 +448,7 @@
#define SID_CHOOSE_DESIGN (SC_VIEW_START + 82)
#define SID_EURO_CONVERTER (SC_VIEW_START + 83)
+#define SID_CHG_PROTECT (SC_VIEW_START + 84)
// Nachrichten -------------------------------------------------------------
@@ -508,7 +511,6 @@
#define SC_HINT_NAVIGATOR_UPDATEALL (SC_MESSAGE_START + 65)
// Funktionen ------------------------------------------------------------
-// noch nach Menues sortiert - besserer Vorschlag?
//#define FID_PRINT_PREVIEW (SC_FUNCTION_START)
@@ -1114,6 +1116,8 @@
#define SCSTR_50_APPLICATION (STR_START + 84)
#define SCSTR_50_LONG_DOCNAME (STR_START + 85)
+#define SCSTR_CHG_PROTECT (STR_START + 86)
+#define SCSTR_CHG_UNPROTECT (STR_START + 87)
// Items
diff --git a/sc/sdi/docsh.sdi b/sc/sdi/docsh.sdi
index dc467478a550..4446e3220650 100644
--- a/sc/sdi/docsh.sdi
+++ b/sc/sdi/docsh.sdi
@@ -3,7 +3,7 @@
// StarCalc
//
// (C) 1994 StarDivision GmbH, Hamburg, Germany
- // $Author: hr $ $Date: 2000-09-18 16:44:52 $ $Revision: 1.1.1.1 $
+ // $Author: er $ $Date: 2001-04-25 14:01:57 $ $Revision: 1.2 $
// $Logfile: T:/sc/sdi/docsh.sdv $ $Workfile: docsh.sdi $
//----------------------------------------------------------------------------
@@ -96,6 +96,7 @@ interface TableDocument : OfficeDocument
FID_CHG_RECORD [ ExecMethod = Execute; StateMethod = GetState; ]
SID_DOCUMENT_COMPARE [ ExecMethod = Execute; StateMethod = GetState; ]
SID_DOCUMENT_MERGE [ ExecMethod = Execute; StateMethod = GetState; ]
+ SID_CHG_PROTECT [ ExecMethod = Execute; StateMethod = GetState; ]
SID_DELETE_SCENARIO [ ExecMethod = Execute; ]
SID_EDIT_SCENARIO [ ExecMethod = Execute; ]
@@ -114,6 +115,9 @@ shell ScDocShell : SfxObjectShell
/*------------------------------------------------------------------------
$Log: not supported by cvs2svn $
+ Revision 1.1.1.1 2000/09/18 16:44:52 hr
+ initial import
+
Revision 1.80 1999/08/24 14:12:28 ANK
#68244# JumpToTable moved
diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi
index 4a49c74c8045..6e2b338bada1 100644
--- a/sc/sdi/scalc.sdi
+++ b/sc/sdi/scalc.sdi
@@ -3462,6 +3462,29 @@ SfxBoolItem TraceChangeMode FID_CHG_RECORD
]
//--------------------------------------------------------------------------
+SfxVoidItem ProtectTraceChangeMode SID_CHG_PROTECT
+()
+[
+ /* flags: */
+ AutoUpdate = FALSE,
+ Cachable = Cachable,
+ FastCall = FALSE,
+ HasCoreId = FALSE,
+ HasDialog = FALSE,
+ ReadOnlyDoc = TRUE,
+ Toggle = FALSE,
+ Container = FALSE,
+ Synchron;
+
+ /* config: */
+ AccelConfig = TRUE,
+ MenuConfig = TRUE,
+ StatusBarConfig = FALSE,
+ ToolBoxConfig = TRUE,
+ GroupId = GID_EDIT;
+]
+
+//--------------------------------------------------------------------------
SfxVoidItem CommentChange FID_CHG_COMMENT
(SfxStringItem Comment FID_CHG_COMMENT)
[
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 8810a4f30db3..804e3a9796e8 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: docsh4.cxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: nn $ $Date: 2001-04-10 18:53:27 $
+ * last change: $Author: er $ $Date: 2001-04-25 14:02:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,7 +96,12 @@
#ifndef _SVX_FMSHELL_HXX //autogen
#include <svx/fmshell.hxx>
#endif
-
+#ifndef _SFX_PASSWD_HXX
+#include <sfx2/passwd.hxx>
+#endif
+#ifndef _SVTOOLS_PASSWORDHELPER_HXX
+#include <svtools/PasswordHelper.hxx>
+#endif
#include "docsh.hxx"
#include "docfunc.hxx"
@@ -135,6 +140,7 @@
#include "docoptio.hxx"
#include "undostyl.hxx"
#include "rangeseq.hxx"
+#include "chgtrack.hxx"
//------------------------------------------------------------------
@@ -624,16 +630,26 @@ void ScDocShell::Execute( SfxRequest& rReq )
ScDocument* pDoc = GetDocument();
if(pDoc!=NULL)
{
- if(pDoc->GetChangeTrack()!=NULL)
+ BOOL bDo = TRUE;
+ ScChangeTrack* pChangeTrack = pDoc->GetChangeTrack();
+ if ( pChangeTrack )
{
- WarningBox aBox( GetDialogParent(), WinBits(WB_YES_NO | WB_DEF_NO),
- ScGlobal::GetRscString( STR_END_REDLINING ) );
+ WarningBox aBox( GetDialogParent(),
+ WinBits(WB_YES_NO | WB_DEF_NO),
+ ScGlobal::GetRscString( STR_END_REDLINING ) );
- if(aBox.Execute()==RET_YES)
+ if( aBox.Execute() == RET_YES )
{
- pDoc->EndChangeTracking();
- PostPaintGridAll();
+ if ( pChangeTrack->IsProtected() )
+ bDo = ExecuteChangeProtectionDialog();
+ if ( bDo )
+ {
+ pDoc->EndChangeTracking();
+ PostPaintGridAll();
+ }
}
+ else
+ bDo = FALSE;
}
else
{
@@ -643,30 +659,65 @@ void ScDocShell::Execute( SfxRequest& rReq )
pDoc->SetChangeViewSettings(aChangeViewSet);
}
- // update "accept changes" dialog
- //! notify all views
-
- SfxViewFrame* pViewFrm = SfxViewFrame::Current();
- if ( pViewFrm && pViewFrm->HasChildWindow(FID_CHG_ACCEPT) )
+ if ( bDo )
{
- SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_CHG_ACCEPT);
- if (pChild)
+ // update "accept changes" dialog
+ //! notify all views
+
+ SfxViewFrame* pViewFrm = SfxViewFrame::Current();
+ if ( pViewFrm && pViewFrm->HasChildWindow(FID_CHG_ACCEPT) )
{
- ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg();
+ SfxChildWindow* pChild = pViewFrm->GetChildWindow(FID_CHG_ACCEPT);
+ if (pChild)
+ {
+ ((ScAcceptChgDlgWrapper*)pChild)->ReInitDlg();
+ }
}
+ // Slots invalidieren
+ if (pBindings)
+ pBindings->InvalidateAll(FALSE);
+ rReq.Done();
}
- // Slots invalidieren
- if (pBindings)
- pBindings->InvalidateAll(FALSE);
+ else
+ rReq.Ignore();
}
}
break;
+ case SID_CHG_PROTECT :
+ {
+ if ( ExecuteChangeProtectionDialog() )
+ rReq.Done();
+ else
+ rReq.Ignore();
+ }
+ break;
+
case SID_DOCUMENT_MERGE:
case SID_DOCUMENT_COMPARE:
{
- //! bei COMPARE eine Warnung, dass alte Changes verlorengehen ??!?!?
-
+ BOOL bDo = TRUE;
+ ScChangeTrack* pChangeTrack = aDocument.GetChangeTrack();
+ if ( pChangeTrack )
+ {
+ if ( nSlot == SID_DOCUMENT_COMPARE )
+ { //! old changes trace will be lost
+ WarningBox aBox( GetDialogParent(),
+ WinBits(WB_YES_NO | WB_DEF_NO),
+ ScGlobal::GetRscString( STR_END_REDLINING ) );
+ if( aBox.Execute() == RET_YES )
+ bDo = ExecuteChangeProtectionDialog( TRUE );
+ else
+ bDo = FALSE;
+ }
+ else // merge might reject some actions
+ bDo = ExecuteChangeProtectionDialog( TRUE );
+ }
+ if ( !bDo )
+ {
+ rReq.Ignore();
+ break;
+ }
SfxApplication* pApp = SFX_APP();
const SfxPoolItem* pItem;
SfxMedium* pMed = NULL;
@@ -891,6 +942,79 @@ void ScDocShell::Execute( SfxRequest& rReq )
}
}
+
+//------------------------------------------------------------------
+
+BOOL ScDocShell::ExecuteChangeProtectionDialog( BOOL bJustQueryIfProtected )
+{
+ BOOL bDone = FALSE;
+ ScChangeTrack* pChangeTrack = aDocument.GetChangeTrack();
+ if ( pChangeTrack )
+ {
+ BOOL bProtected = pChangeTrack->IsProtected();
+ if ( bJustQueryIfProtected && !bProtected )
+ return TRUE;
+
+ String aTitle( ScResId( bProtected ? SCSTR_CHG_UNPROTECT : SCSTR_CHG_PROTECT ) );
+ String aText( ScResId( SCSTR_PASSWORD ) );
+ String aPassword;
+
+ SfxPasswordDialog* pDlg = new SfxPasswordDialog(
+ GetDialogParent(), &aText );
+ pDlg->SetText( aTitle );
+ pDlg->SetMinLen( 1 );
+ pDlg->SetHelpId( SID_CHG_PROTECT );
+ pDlg->SetEditHelpId( HID_CHG_PROTECT );
+ if ( !bProtected )
+ pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
+ if ( pDlg->Execute() == RET_OK )
+ aPassword = pDlg->GetPassword();
+ delete pDlg;
+
+ if ( aPassword.Len() )
+ {
+ com::sun::star::uno::Sequence< sal_Int8 > aPass;
+ SvPasswordHelper::GetHashPassword( aPass, aPassword );
+ if ( bProtected )
+ {
+ if ( aPass == pChangeTrack->GetProtection() )
+ {
+ if ( bJustQueryIfProtected )
+ bDone = TRUE;
+ else
+ pChangeTrack->SetProtection(
+ com::sun::star::uno::Sequence< sal_Int8 > (0) );
+ }
+ else
+ {
+ InfoBox aBox( GetDialogParent(),
+ String( ScResId( SCSTR_WRONGPASSWORD ) ) );
+ aBox.Execute();
+ }
+ }
+ else
+ pChangeTrack->SetProtection( aPass );
+ 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();
+ }
+ bDone = TRUE;
+ }
+ }
+ }
+ else if ( bJustQueryIfProtected )
+ bDone = TRUE;
+ return bDone;
+}
+
+
//------------------------------------------------------------------
void ScDocShell::DoRecalc( BOOL bApi )
@@ -1630,12 +1754,18 @@ void ScDocShell::GetState( SfxItemSet &rSet )
break;
case FID_CHG_RECORD:
+ rSet.Put( SfxBoolItem( nWhich,
+ aDocument.GetChangeTrack() != NULL ) );
+ break;
+
+ case SID_CHG_PROTECT:
{
- ScDocument* pDoc = GetDocument();
- if(pDoc->GetChangeTrack()!=NULL)
- rSet.Put( SfxBoolItem( nWhich, TRUE));
+ ScChangeTrack* pChangeTrack = aDocument.GetChangeTrack();
+ if ( pChangeTrack )
+ rSet.Put( SfxBoolItem( nWhich,
+ pChangeTrack->IsProtected() ) );
else
- rSet.Put( SfxBoolItem( nWhich, FALSE));
+ rSet.DisableItem( nWhich );
}
break;
diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx
index 9ae3f03c0fa3..b66831bb8e0d 100644
--- a/sc/source/ui/miscdlgs/acredlin.cxx
+++ b/sc/source/ui/miscdlgs/acredlin.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: acredlin.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: er $ $Date: 2001-03-14 14:35:33 $
+ * last change: $Author: er $ $Date: 2001-04-25 14:03:51 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -973,7 +973,7 @@ void ScAcceptChgDlg::UpdateView()
pScChangeAction=pScChangeAction->GetNext();
}
- if(bTheFlag && !pDoc->IsDocEditable())
+ if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
bTheFlag=FALSE;
pTPView->EnableAccept(bTheFlag);
@@ -1702,7 +1702,7 @@ void ScAcceptChgDlg::AppendChanges(ScChangeTrack* pChanges,ULONG nStartAction,
pScChangeAction=pScChangeAction->GetNext();
}
- if(bTheFlag && !pDoc->IsDocEditable())
+ if( bTheFlag && (!pDoc->IsDocEditable() || pChanges->IsProtected()) )
bTheFlag=FALSE;
pTPView->EnableAccept(bTheFlag);
@@ -1943,8 +1943,9 @@ IMPL_LINK( ScAcceptChgDlg, UpdateSelectionHdl, Timer*, pTi)
}
}
- pTPView->EnableAccept(pDoc->IsDocEditable() && bAcceptFlag);
- pTPView->EnableReject(pDoc->IsDocEditable() && bRejectFlag);
+ BOOL bEnable = pDoc->IsDocEditable() && !pDoc->GetChangeTrack()->IsProtected();
+ pTPView->EnableAccept( bAcceptFlag && bEnable );
+ pTPView->EnableReject( bRejectFlag && bEnable );
return 0;
}
diff --git a/sc/source/ui/src/scstring.src b/sc/source/ui/src/scstring.src
index 4f6b460c5b72..e4a1971d32bf 100644
--- a/sc/source/ui/src/scstring.src
+++ b/sc/source/ui/src/scstring.src
@@ -2,9 +2,9 @@
*
* $RCSfile: scstring.src,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: kz $ $Date: 2001-04-03 19:36:22 $
+ * last change: $Author: er $ $Date: 2001-04-25 14:04:26 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2153,6 +2153,54 @@ String SCSTR_UNPROTECTTAB
Text[ turkish ] = "Tablo korumasn kaldr";
Text[ language_user1 ] = " ";
};
+String SCSTR_CHG_PROTECT
+{
+ Text = "Aufzeichnung schtzen" ;
+ Text [ ENGLISH ] = "Protect trace" ;
+ Text [ english_us ] = "Protect trace" ;
+ Text [ dutch ] = "Protect trace" ;
+ Text [ italian ] = "Protect trace" ;
+ Text [ spanish ] = "Protect trace" ;
+ Text [ french ] = "Protect trace" ;
+ Text [ swedish ] = "Protect trace" ;
+ Text [ danish ] = "Protect trace" ;
+ Text [ portuguese ] = "Protect trace" ;
+ Text [ portuguese_brazilian ] = "Protect trace" ;
+ Text[ chinese_simplified ] = "Protect trace";
+ Text[ russian ] = "Protect trace";
+ Text[ polish ] = "Protect trace";
+ Text[ japanese ] = "Protect trace";
+ Text[ chinese_traditional ] = "Protect trace";
+ Text[ arabic ] = "Protect trace";
+ Text[ greek ] = "Protect trace";
+ Text[ korean ] = "Protect trace";
+ Text[ turkish ] = "Protect trace";
+ Text[ language_user1 ] = " ";
+};
+String SCSTR_CHG_UNPROTECT
+{
+ Text = "Aufzeichnungsschutz aufheben" ;
+ Text [ ENGLISH ] = "Unprotect trace" ;
+ Text [ english_us ] = "Unprotect trace" ;
+ Text [ dutch ] = "Unprotect trace" ;
+ Text [ italian ] = "Unprotect trace" ;
+ Text [ spanish ] = "Unprotect trace" ;
+ Text [ french ] = "Unprotect trace" ;
+ Text [ swedish ] = "Unprotect trace" ;
+ Text [ danish ] = "Unprotect trace" ;
+ Text [ portuguese ] = "Unprotect trace" ;
+ Text [ portuguese_brazilian ] = "Unprotect trace" ;
+ Text[ chinese_simplified ] = "Unprotect trace";
+ Text[ russian ] = "Unprotect trace";
+ Text[ polish ] = "Unprotect trace";
+ Text[ japanese ] = "Unprotect trace";
+ Text[ chinese_traditional ] = "Unprotect trace";
+ Text[ arabic ] = "Unprotect trace";
+ Text[ greek ] = "Unprotect trace";
+ Text[ korean ] = "Unprotect trace";
+ Text[ turkish ] = "Unprotect trace";
+ Text[ language_user1 ] = " ";
+};
String SCSTR_PASSWORD
{
Text = "Kennwort:" ;
diff --git a/sc/util/hidother.src b/sc/util/hidother.src
index f5dd247ab4ad..46eac5613c60 100644
--- a/sc/util/hidother.src
+++ b/sc/util/hidother.src
@@ -2,9 +2,9 @@
*
* $RCSfile: hidother.src,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: dr $ $Date: 2001-03-13 15:38:11 $
+ * last change: $Author: er $ $Date: 2001-04-25 14:05:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -118,6 +118,7 @@ hidspecial HID_SC_REN_AFMT_NAME { HelpID = HID_SC_REN_AFMT_NAME; };
hidspecial HID_SC_RENAME_AUTOFMT { HelpID = HID_SC_RENAME_AUTOFMT; };
hidspecial HID_PASSWD_TABLE { HelpID = HID_PASSWD_TABLE; };
hidspecial HID_PASSWD_DOC { HelpID = HID_PASSWD_DOC; };
+hidspecial HID_CHG_PROTECT { HelpID = HID_CHG_PROTECT; };
// 2. Seite Funktionsautopilot: nur als Unique-IDs